Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDriverManager not working in VS 2022 C# #227

Closed
DirkDiggler77 opened this issue Jan 14, 2023 · 11 comments
Closed

WebDriverManager not working in VS 2022 C# #227

DirkDiggler77 opened this issue Jan 14, 2023 · 11 comments

Comments

@DirkDiggler77
Copy link

Hello!

I am trying to get WebDriverManager working in my VS project BUT it doesn't seem to working.
My Browser is Chrome 109 and my ChromeDriver is 107. I was under the impression when using WebDriverManager
that if they were out of sync WebDriverManager would still allow them to run by having the project use the most current version of ChromeDriver. Is this not the case? Any additional help would be greatly appreciated.

Thanks
Dirk!

// Error
 Test
 Source: DAM_Basics.cs line 25
 Duration: 2.1 sec

Message: 
System.InvalidOperationException : session not created: This version of ChromeDriver only supports Chrome version 107
Current browser version is 109.0.5414.75 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe (SessionNotCreated)

Stack Trace: 
WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
WebDriver.StartSession(ICapabilities desiredCapabilities)
WebDriver.ctor(ICommandExecutor executor, ICapabilities capabilities)
ChromiumDriver.ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
ChromeDriver.ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
ChromeDriver.ctor(ChromeOptions options)
ChromeDriver.ctor()
Tests.SetUp() line 19

// Script

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using WebDriverManager;
using WebDriverManager.DriverConfigs.Impl;
using WebDriverManager.Helpers;

namespace Test
{
[TestFixture]
public class Tests
{
private IWebDriver _webDriver;

    [SetUp]
    public void SetUp()
    {
        new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
        _webDriver = new ChromeDriver();
    }



    [Test]
    public void Test()
    {
        _webDriver.Navigate().GoToUrl("https://www.google.com");
        Assert.True(_webDriver.Title.Contains("Google"));
    }
}

}

@khalidifq
Copy link

Same issue is experienced by me on VS2022. Any updates on how to resolve this?

@JohnnyNgo
Copy link

Same issue VS2022

@JohnnyNgo
Copy link

JohnnyNgo commented Feb 26, 2023

Same issue is experienced by me on VS2022. Any updates on how to resolve this?

brothers, i found a solution for now

string file = new DriverManager().SetUpDriver(new ChromeConfig());
string dir = Path.GetDirectoryName(file); // Redundant!
IWebDriver driver = new ChromeDriver(dir);

@DirkDiggler77
Copy link
Author

@JohnnyNgo Will give this a try!

Cheers
Dirk

@AllOfUs9898
Copy link

@JohnnyNgo Thank you for the solution. Just tried it and it works!

@matthewdavidjeffery
Copy link

matthewdavidjeffery commented Mar 22, 2023

@JohnnyNgo This also worked for me.

@Sahnreis
Copy link

this issue is a duplicate of #209

@samueltian666
Copy link

the best:
new DriverManager().SetUpDriver(new ChromeConfig(), VersionResolveStrategy.MatchingBrowser);
ChromeDriver driver = new();
That's it!

@dwiggins5091
Copy link

VersionResolveStrategy.MatchingBrowser doesnt work as expected... regardless of the Visual Studio version that a developer is using on their machine

@Abhijith1190
Copy link

@dwiggins5091 how do we overcome this issue? Please help

@ms6073
Copy link

ms6073 commented Jul 27, 2023

@dwiggins5091 how do we overcome this issue? Please help

Take a look at issue 253 for more context regarding the cause of the issue.

@rosolko rosolko closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests