我使用以下代码段创建Internet Explorer浏览器并进行一些测试。由于下面给出的例外,我无法创建ie浏览器。我该如何解决这个问题?
require 'rubygems'
require 'watir-webdriver'
require 'phantomjs'
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 300
browser = Watir::Browser.new :ie, :http_client => client
browser.goto "some url"
错误 -
Started InternetExplorerDriver server (32-bit)
2.29.0.0
Listening on port 5555
C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok': Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (Selenium::WebDriver::Error::NoSuchDriverError)
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:98:in `create_session'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:68:in `initialize'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/ie/bridge.rb:47:in `initialize'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:35:in `new'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
from C:/code/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver.rb:67:in `for'
from C:/code/ruby/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.2/lib/watir-webdriver/browser.rb:46:in `initialize'
from web-test.rb:8:in `new'
答案 0 :(得分:1)
我找不到任何可以解决此问题的ruby代码。但是,我了解到您可以更改IE设置以解决此问题 - http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html
如何设置保护模式设置
在IE中,从“工具”菜单(或更高版本工具栏中的齿轮图标)中选择“" Internet选项”。转到“安全”选项卡。在每个区域的对话框底部,您应看到一个标有"启用保护模式的复选框。"将复选框的值设置为每个区域的相同值(选中或取消选中)。这是参考对话框: