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

2

13

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 .

Judge answered 8/9, 2016 at 18:44 Comment(2)
Why are you using firefox profile folder and not setting profile setting through selenium code ? What is the requirement for firefox profile?Panne
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 .Judge
M
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

Mowry answered 14/9, 2016 at 18:17 Comment(0)
C
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/
Cob answered 15/9, 2016 at 22:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.