2013-02-14 75 views
0

所以,我使用 -硒webdriver的錯誤只是打開IE

gem 'watir-webdriver', '0.5.4' 
gem 'selenium-webdriver', '2.21.1' 

和JRuby - 1.6.5

所有我試圖做的就是打開IE瀏覽器。我有IE版本8.

>> require "rubygems" 
=> true 

?> require "watir-webdriver" 
=> true 

?> @b = Watir::Browser.new :ie 
Selenium::WebDriver::Error::UnhandledAlertError: Modal dialog present 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/response.rb:15:in `initialize' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/http/default.rb:64:in `request' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/http/default.rb:62:in `request' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/http/common.rb:40:in `call' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/bridge.rb:92:in `create_session' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/ie/bridge.rb:40:in `initialize' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver/common/driver.rb:35:in `for' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/selenium-webdriver-2.21.2/lib/selenium/webdriver.rb:63:in `for' 
from C:/jruby-1.6.5/lib/ruby/gems/1.8/gems/watir-webdriver-0.5.8/lib/watir-webdriver/browser.rb:35:in `initialize' 
from (irb):5:in `evaluate' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:158:in `eval_input' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:271:in `signal_status' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:155:in `eval_input' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:154:in `eval_input' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:71:in `start' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:70:in `catch' 
from C:/jruby-1.6.5/lib/ruby/1.8/irb.rb:70:in `start' 
from C:/jruby-1.6.5/bin/jirb:13:in `(root)' 
from -e:1:in `load' 
from -e:1:in `(root)'>> 

IE webdriver被打開,但上面的錯誤來了。

當我使用任何其他瀏覽器 - Firefox或Chrome - 他們只是開,因爲他們應該打開。它剛從本週開始發生。我的意思是我現在使用硒-webdriver多年,從未遇到過打開IE或任何瀏覽器的問題。錯誤表示有一個模式對話框,但是當我剛剛打開IE時,怎麼會有一個模式對話框,並且當IE webdriver打開時我沒有看到任何對話框。如果是這樣,爲什麼其他瀏覽器不抱怨?

我假設它可能需要一些窗口或安全更新,大幹快上公司的筆記本電腦推到做,但我只是想看看是否有其他人也遇到過這一點,是什麼解決辦法?

+0

在IE自己打開一個空白窗口,你看到一個對話框或類似的東西?通常,它表示硒在「自然」瀏覽器狀態下檢測到某些內容不符合要求 – 2013-02-14 16:01:35

回答

0

有兩種可能性,我能想到的。一個是當你試圖執行你的測試時你打開了Windows任務管理器。在以前版本的IE驅動程序中存在一個錯誤,如果在使用IE驅動程序運行代碼時打開任務管理器,則可能會錯誤地拋出UnexpectedAlertException。

第二個選項是一個瀏覽器插件,它在內部創建一個對話窗口,但保持它隱藏起來。有許多針對IE的防病毒和其他反惡意軟件插件可能會導致此問題。

在這兩種情況下,看到更新的later version of IEDriverServer.exe是否能解決這個問題。

0

好的,找到了解決辦法。這是反病毒的東西。問題是 - 當您使用IE瀏覽器運行腳本時,McAfee網站顧問模式窗口位於IE瀏覽器之上,因此我們無法訪問IE瀏覽器甚至打開它。只是因爲IE在我的工作環境中是「默認」和「首選」瀏覽器,所以它只針對IE。

McAfee提供兩個DLL文件並複製粘貼他們到一些特定的位置解決了問題。對不起,我在這個問題中使用了所有的想法,但它與硒沒有關係,但是是McAfee問題。結束這個問題。