Mat*_*teu 5 ruby firefox selenium selenium-webdriver
我想为以下驱动程序设置 Firefox 配置文件:
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox
Run Code Online (Sandbox Code Playgroud)
我尝试添加:
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
Run Code Online (Sandbox Code Playgroud)
但配置文件选项不存在
谢谢
您应该尝试如下:-
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
Run Code Online (Sandbox Code Playgroud)
注意:- 您应该按照此步骤了解有关Ruby绑定的更多信息。
希望它能帮助你...:)