Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the firefox profile at the node end in remote webdriver/grid configuration

It is always suggested to set the firefox profile in DesiredCapabilities and pass that through the wire ,where the hub is running . Like below

DesiredCapabilities caps = DesiredCapabilities.firefox();

    FirefoxProfile profile=new FirefoxProfile(new File("Local Path to firefox profile folder"));
    caps.setCapability(FirefoxDriver.PROFILE, profile);

URL url = new URL("http://localhost:4444/wd/hub");      
WebDriver driver= new RemoteWebDriver(url,caps );

But sending the huge 87-90 mb profile info to hub over http ,for each selenium test case slowing down the test case execution .

I have tried configuring the grid node with "Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"", property in json node config file like below.

{
"configuration":
{
.//Other Settings
.//Other Settings
.//Other Settings
"Dwebdriver.firefox.profile=E:\\Firefox_Profile_Location":"",
"maxSession":7,
"registerCycle":5000,
"register":true
},
"capabilities":
[

{"browserName":"firefox",
"seleniumProtocol":"WebDriver",
"maxInstances":5,
"platform":"VISTA"
}
]
}

But running with the above configuration is throwing below error .

WebDriverException: Firefox profile 'E:\Firefox_Profile_Location' named in system property 'webdriver.firefox.profile' not found

Advanced thanks for any help on how to configure the firefox profile from the node side .

like image 783
Som Avatar asked Sep 08 '16 18:09

Som


People also ask

What is the basic use of Firefox profiles and how can we use them using selenium?

Firefox profile is the collection of settings, customization, add-ons and other personalization settings that can be done on the Firefox Browser. You can customize Firefox profile to suit your Selenium automation requirement. Also, Firefox or any other browser handles the SSL certificates settings.

What is the name of the Firefox browser driver?

Why GeckoDriver is used? After version 47, Mozilla Firefox came out with Marionette, which is an automation driver. It remotely controls either the UI or the internal JavaScript of a Gecko platform, such as Firefox. Hence, we require GeckoDriver for Firefox.


2 Answers

You need to provide the profile in the capabilities object as a base64 encoded zip:

var fs = require('fs');
capabilities: [
  {
    browserName: 'firefox',
    seleniumProtocol: 'WebDriver',
    maxInstances: 5,
    platform: 'VISTA',
    firefox_profile: new Buffer(fs.readFileSync("./profile.zip")).toString('base64')
  }
]

Moreover Firefox creates the missing files for a given profile. So you should keep just the necessary files in the profile depending on your needs:

Preferences:  user.js
Passwords:    key3.db
              logins.json
Cookies:      cookies.sqlite
Certificate:  cert8.sqlite
Extensions:   extensions/
like image 129
Florent B. Avatar answered Oct 16 '22 19:10

Florent B.


I think you'll have to use firefox profile name and not the location.

"webdriver.firefox.profile":"default"

Have a look at this and this and this

If you want know how to create a profile follow this and this

like image 23
user1207289 Avatar answered Oct 16 '22 19:10

user1207289