Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a firefox profile on a Selenium WebDriver remote with Ruby

I want to set a Firefox profile to the following driver:

driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox

I've tried adding:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.downloadDir'] = '/home/seluser'
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => :firefox, :profile => profile

But the profile option does not exist

Thanks

like image 579
Mateu Avatar asked Oct 19 '22 06:10

Mateu


1 Answers

You should try as below :-

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.downloadDir'] = '/home/seluser'

capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)

driver = Selenium::WebDriver.for :remote, :url => "http://localhost:4444/wd/hub", :desired_capabilities => capabilities

Note :- You should follow this to learn more about Ruby binding.

Hope it will help you...:)

like image 105
Saurabh Gaur Avatar answered Oct 21 '22 00:10

Saurabh Gaur