sathiya
sathiya

Reputation: 261

selenium c# edge browser : 'Unexpected error. Unknown error'

OS Build Number:- 18363.900 Edge Version: 83.0.478.54 MicrosoftWebDriver Version: 83.0.478.54

Here is the code:

  System.Environment.SetEnvironmentVariable("webdriver.edge.driver", "E:\\edgedriver_win64\\msedgedriver.exe");
  IWebDriver driver = new EdgeDriver();

I am getting error as: OpenQA.Selenium.WebDriverException: 'Unexpected error. Unknown error'

Upvotes: 0

Views: 1033

Answers (1)

Yu Zhou
Yu Zhou

Reputation: 12946

Which version of Selenium WebDriver are you using? I suggest you to use the latest version 4.0.0-alpha05 and use the code below:

EdgeOptions edgeOptions = new EdgeOptions();
edgeOptions.UseChromium = true;
edgeOptions.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
var msedgedriverDir = @"D:\webdriver83.0.478.54";
var driver = new EdgeDriver(msedgedriverDir, edgeOptions);
driver.Navigate().GoToUrl("https://bing.com");
Thread.Sleep(3000);
driver.Close(); 

Note: Change the paths in the code to your owns.

Result:

enter image description here

Upvotes: 1

Related Questions