0
votes

I am trying to setup Selenium Tests with the Selenium web driver. I have installed the Selenium Libraries on the Visual Studio.

I have this code here:

IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://www.google.com/");    

enter image description here

I get this error:

System.InvalidOperationException : session not created: This version of ChromeDriver only supports Chrome version 85 (SessionNotCreated)

Stack Trace:

RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
RemoteWebDriver.ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
ChromeDriver.ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
ChromeDriver.ctor(ChromeOptions options)
ChromeDriver.ctor()
UnitTest1.WebDriverTesting() line 70

I have checked the Libraries that I have installed. It as latest version of Chrome driver 90 and also installed version of Chrome is 90.

Any lead will be appreciated.

Thanks

1
Is there a reason you have 2 Chromedriver's installed? Get rid of the top one. You may need to into your bin folder and remove the .exe manually as well. - JD2775
As @JD2775 said. You only need 1 chrome driver. remove the one that says 85. You might wanna check taskmanage rand kill all chromedriver.exe. Also change this line IWebDriver driver = new ChromeDriver("."); so that it uses the bin chromedriver.exe - art_architect

1 Answers

2
votes

Based on my test and other's suggestion, you can try the following steps to solve the problem about the chrome driver in c#.

First, please install the nuget-package Selenium.WebDriver and Selenium.WebDriver.ChromeDriver.(Please remove the first nuget-package in your picture)

Second, we can find the chromedriver.exe in the path packages\Selenium.WebDriver.ChromeDriver.90.0.4430.2400\driver\win32\chromedriver.exe.

Third, please copy the chromedriver.exe to Project\bin\debug folder.

Finally, you can try the following code to open the chrome browser with the url https://www.google.com/.

        ChromeDriver driver = new ChromeDriver(".");
        driver.Navigate().GoToUrl("https://www.google.com/");