Using Watir and Selenium how to add certificate to profile for Firefox?

46 views Asked by At

I'm trying to run Firefox via the Watir gem with a predefined profile that has a certificate for authorization. I created a new profile for Firefox and manually added the certificate. Now I can't run Watir browser with this profile.

I tried to set profile path.

profile_path = '/path/to/profile'
profile=Selenium::WebDriver::Firefox::Profile.from_name(profile_path)
browser_options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
browser = Watir::Browser.new :firefox, options: browser_options

I also tried set profile via Waitr options

browser = Watir::Browser.new :firefox, options: {args: ['-profile', '/path/to/profil']}

Maybe it is a possibility to add certificate during initialize Watir::Browser

UDAPTE::

When I type in firefox about:profiles I see that firefox use my predefinied profile, but isn't true.

1

There are 1 answers

2
Rajagopalan On

Try this

profile_path = '/path/to/profile'
profile = Selenium::WebDriver::Firefox::Profile.new(profile_path)
browser = Watir::Browser.new :firefox, options: { profile: profile }