Webdriver Ruby绑定-设置功能 [英] Webdriver Ruby Bindings - Setting Capabilities
问题描述
我正在为Webdriver使用Ruby绑定,并且在为IE创建Webdriver实例时需要设置特定功能.功能是:ignore_zoom_setting.但是,我可以传递给驱动程序的选项仅限于:timeout,:port,:http_client,:introduce_flakiness_by_ignoring_security_domains和:native_events.
I am using Ruby bindings for Webdriver and need to set a particular capability when creating a webdriver instance for IE. The capabilitiy is :ignore_zoom_setting. However, the options I can pass through to the driver are limited to :timeout, :port, :http_client, :introduce_flakiness_by_ignoring_security_domains, and :native_events.
我发现传递期望的功能对象的唯一方法是使用远程Webdriver.我可以以某种方式调用Selenium :: WebDriver.for:ie并传递功能吗?
The only way I've found of passing a desired capabilities object is if I use remote webdriver. Can I somehow call Selenium::WebDriver.for :ie and pass in capabilities as well?
标记
推荐答案
哦,可以.这是应该帮助您的代码段
Oh yes you can. here is the code snippet that should help you
oops提供了Java代码.我会让它在那里,但对于红宝石,您确实需要使用远程
oops gave code for java. I will let it be there but for ruby you do need to use remote
caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => caps
对于Java
DesiredCapabilities cap = new DesiredCapabilities();
cap.setJavascriptEnabled(false);
driver = new InternetExplorerDriver(cap);
这篇关于Webdriver Ruby绑定-设置功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!