Himadri Ganguly
Himadri Ganguly

Reputation: 743

Chrome Browser Version In Selenium

I have set up one Selenium Grid with one Hub in Ubuntu Server and one Node in Ubuntu Desktop. Google Chrome version on Node is Version 85.0.4183.83 (Official Build) (64-bit). And my python code for creating session is

# Add Chrome options
options = webdriver.ChromeOptions()
options.add_argument("--disable-extensions")
options.set_capability("browserVersion", "85.0.4183.83")
options.set_capability("platformName", "linux")

# Open a remote browser Session
driver = webdriver.Remote(
    command_executor='http://192.168.56.7:4444/wd/hub',
    options=options
)

But when I am passing options.set_capability("browserVersion", "85.0.4183.83") it gives error

selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session cannot find : Capabilities {browserName: chrome, browserVersion: 85.0.4183.83, goog:chromeOptions: {args: [--disable-extensions], extensions: []}, platformName: linux, version: }

But without that line, it works absolutely fine.

Also, like to know if there is any option of passing only the Major version of the browser like 85 without passing the exact version number like 85.0.4183.83.

Thanks to all in advance.

Upvotes: 1

Views: 9254

Answers (1)

Himadri Ganguly
Himadri Ganguly

Reputation: 743

Solved the issue. As the version information is not passed on to the HUB it is cannot verify the version information. So have to pass nodeConfig when connecting to HUB from the NODE.

node-config.json

{
  "capabilities": [
    {
      "browserName": "firefox",
      "browserVersion": "79.0"
    },
    {
      "browserName": "chrome",
      "browserVersion": "85.0"
    }
  ]
}

Then start the connection using

java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://[HUB-IP]:4444/grid/register/ -nodeConfig node-config.json

Now passing options.set_capability("browserVersion", "85.0") will work. So using this you can now specify which OS, Browser, and Browser Version you want to test on.

Ref:- https://www.selenium.dev/documentation/en/grid/grid_3/setting_up_your_own_grid/

Upvotes: 1

Related Questions