Question

The goal would be to set the profile the same way as in a regular Browser object,

$browser = Watir::Browser.new b, :profile => profile

Is it possible to load a firefox Profile using the headless gem?

My current code,

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
Was it helpful?

Solution

Just the same

if $global_cfg['headless'] == 'on'
    headless = Headless.new
    headless.start
end

$browser = Watir::Browser.new b, :profile => profile
$browser.goto url.to_s
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top