如何使用Ruby在Selenium WebDriver远程上设置firefox配置文件

时间:2016-07-06 11:02:43

标签: ruby selenium firefox selenium-webdriver

我想将Firefox配置文件设置为以下驱动程序:

driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox

我尝试添加:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.downloadDir'] = '/home/seluser'
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox, :profile => profile

但配置文件选项不存在

由于

1 个答案:

答案 0 :(得分:2)

你应该尝试如下: -

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.downloadDir'] = '/home/seluser'

capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)

driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => capabilities

注意: - 您应该关注this了解有关Ruby绑定的更多信息。

希望它会帮助你...... :)