测试我在Chrome和Firefox中运行良好在IE9中显得片状或眨眼。我理解基于java的修复是为了设置一个功能
caps.setCapability("requireWindowFocus", true);
我在env.rb中解释了一个粗略的红宝石尝试......
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
case get_browser
when 'ie'
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer
caps.setCapability("requireWindowFocus", true)
Capybara::Selenium::Driver.new(app, :browser => :internet_explorer, :desired_capabilities => caps)
else
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
end
并发现以下nomethod错误
NoMethodError: undefined method `setCapability' for #<Selenium::WebDriver::Remote::Capabilities:0x3e9b218>
非常感谢ruby修复此问题。
答案 0 :(得分:5)
基于Ruby bindings页面,功能设置如下:
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer
caps["requireWindowFocus"] = true
Capybara::Selenium::Driver.new(app, :browser => :internet_explorer, :desired_capabilities => caps)