Click here to Skip to main content
15,038,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to make some tests with Selenium but I notece that the chromedriver depend of the browser version, how it is on the documentation page:
Chrome 63-65 works with chromedriver 2.36
Chrome 62-64 works with chromedriver 2.35
Chrome 61-63 works with chromedriver 2.34
Chrome 60-62 works with chromedriver 2.33
Chrome > 57, use chromedriver 2.28
Chrome > 54, use chromedriver 2.25
Chrome = 53, use chromedriver 2.24
Chrome > 49, use chromedriver 2.22
Chrome > 43, use chromedriver 2.20
Chrome > 41, use chromedriver 2.15
older versions, use chromedriver 2.10

so, Is there a way to work with several browser version and set the chromedriver dinamically?
Like, if I am runing the test on a pc with the Chrome 56 it sets the chromedriver v2.25, if I am runing the test on a pc with the Chrome 61 it sets the chromedriver v2.33.

How is it possible?

What I have tried:

I'm trying and testing the inicialization of the ChromeDriver with this code:

private void inicializeChrome()
    ChromeOptions chromeOptions = new ChromeOptions();
    //chromeOptions.AddArgument("--headless");//hide browser

    ChromeDriverService chromeService = ChromeDriverService.CreateDefaultService();
    chromeService.SuppressInitialDiagnosticInformation = true;
    chromeService.HideCommandPromptWindow = true;

    driver = new ChromeDriver(chromeService, chromeOptions);

    ICapabilities capabilities = ((RemoteWebDriver)driver).Capabilities;

Updated 5-Aug-18 8:40am
Vibhav Ramcharan 3-Jan-20 9:49am
You may want to look at using Selenium Grid (SE), SE allows you to control the version of the RemoteWebDriver/ChromeDriver per test machine / PC via a json file. You can distribute a single test to multiple PC's (Nodes).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900