12

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 .

AdityaReddy
  • 3,595
  • 8
  • 25
Som
  • 4,300
  • 4
  • 25
  • 31
  • Why are you using firefox profile folder and not setting profile setting through selenium code ? What is the requirement for firefox profile? – Amanpreet Kaur Sep 12 '16 at 09:30
  • By setting through the code , it has to get transferred over the http to the node end , and it takes time . I want to reduce the time by setting the firefox profile configuration at node end with conde configuration settings . – Som Sep 14 '16 at 08:36

2 Answers2

3

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

William Desportes
  • 728
  • 10
  • 20
user1207289
  • 2,575
  • 4
  • 26
  • 54
3

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/
Florent B.
  • 37,063
  • 6
  • 68
  • 92