0
加载配置文件的目标将是设置配置文件以同样的方式作为普通浏览器对象,的Watir-webdriver的 - 使用无头宝石
$browser = Watir::Browser.new b, :profile => profile
是否有可能使用 headless加载的Firefox配置文件宝石?
我当前的代码,
profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.folderList'] = 2
profile['browser.download.dir'] = "#{Dir.pwd}"
profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf,application/x-tar-gz, application/x-gzip, application/x-compressed"
if $global_cfg['headless'] == 'on'
headless = Headless.new
headless.start
$browser = Watir::Browser.start url.to_s
else
$browser = Watir::Browser.new b, :profile => profile
$browser.goto url.to_s
end
你能质疑更清晰? 'headless' gem是一个Xvfb包装器,它与WebDriver的Firefox配置文件无关。 – p0deje 2012-03-14 09:49:01
需要无头的gem虚拟化没有安装x服务器的远程Jenkins服务器上的GUI执行。但是,我还需要修改Firefox配置文件,以便我可以自动下载一系列文件类型。我成功地使用Watir :: Browser.new b,:profile => profile ,但是使用无头模式使用相同配置文件的正确sintax是什么? – 2012-03-14 15:00:51