Joao Figueiredo
Joao Figueiredo

Reputation: 3188

watir-webdriver - load a Profile using headless gem

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

Upvotes: 0

Views: 784

Answers (1)

p0deje
p0deje

Reputation: 4073

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

Upvotes: 1

Related Questions