sameer
sameer

Reputation: 41

How to test multiple version of google chrome using chromedriver?

selenium web-driver with java then how to use chrome driver for test their lower version of Google chrome

Upvotes: 1

Views: 11011

Answers (3)

Ben George
Ben George

Reputation: 1005

Install chrome to custom location, be sure to turn off auto-update. Use following code to use non-default binary.

    ChromeOptions options = new ChromeOptions();
    options.setBinary("/path/to/binary");

    DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
    desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);

    WebDriver webDriver = new ChromeDriver(desiredCapabilities);

Upvotes: 2

Jobet Samuel
Jobet Samuel

Reputation: 56

You would use capabilities to point to the right binary file of the browser to be launced.But not all versions of chrome browser is supported by different versions of chromedriver. You will find exceptions stating that version of browser expected is greater or equal to 30.0.

For ex:- Chromium Browser(33.0.1729.0 )works fine with ChromeDriver 2.7 and not the with the older ones.

You can choose from all the chromedriver version available from the link below:- http://chromedriver.storage.googleapis.com/index.html

Upvotes: 2

Pavel Janicek
Pavel Janicek

Reputation: 14738

From the official wiki page:

Overriding the Chrome binary location

You can specify the location of the Chrome binary by passing the "chrome.binary" capability, e.g. with a typical Chromium install on Debian:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "/usr/lib/chromium-browser/chromium-browser");
WebDriver driver = new ChromeDriver(capabilities);

I suggest you try this approach - tell where the binary of lower version is and start ChromeDriver. Never tried it, but I think it might work

Upvotes: 3

Related Questions