目標は、通常のブラウザオブジェクトと同じ方法でプロファイルを設定することです。
$browser = Watir::Browser.new b, :profile => profile
ヘッドレスジェムを使用して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