Error encountered: Unknown error while using Microsoft Edge WebDriver

When attempting to utilize Microsoft Edge automation with Selenium, I keep encountering the following exception:

OpenQA.Selenium.WebDriverException: Unexpected error. Unknown error

The NuGet package I am using is Selenium.WebDriver.MicrosoftDriver version 17.17134.0.

My code consists of simply initializing the constructor as follows:

var driver = new EdgeDriver();

I have experimented with different overloads that were recommended:

var driver = new EdgeDriver(new EdgeOptions());

var driver = new EdgeDriver(pathToMicrosoftWebDriverExecutable);

However, none of these solutions have worked. I have ensured that the WebDriver version from Microsoft corresponds with the Edge version on the testing machine.

Is there a way to obtain a more detailed error message? It should be noted that all Selenium unit tests perform correctly with Firefox and Chrome WebDrivers, with only Edge presenting an issue.

Answer №1

Although you mentioned having the same versions, I encountered the same error and found a solution that may be helpful to you.

It seems that Microsoft has stopped releasing the Web Driver as a standalone version, which could be causing the problem. (More information can be found here) Currently, Edge is at version 17763, while the NuGet package is at 17134. To resolve this, I had to install it as a standalone by navigating to Settings > Apps > Apps & features > Manage optional features." The link provided includes additional instructions.

After installing, I directed the driver to the location specified and it finally worked.

var driver = new EdgeDriver("C:\\Windows\\System32\\", edgeOptions);

Answer №2

After some trial and error, I stumbled upon a solution that miraculously worked for my issue as well. I kept receiving the troublesome "Message: OpenQA.Selenium.WebDriverException : Unexpected error. Unknown error".

By following Brian Murphy's guidance on installing Microsoft Edge Driver as a Standalone through managing optional features, I was able to resolve the problem without having to modify any of my C# code. It's unclear where Windows placed the installation, but my test, which previously failed at Driver = new EdgeDriver(edgeService, options);

suddenly began to pass once more.

Answer №3

Although this solution doesn't guarantee to resolve all edge driver issues, I successfully overcame this error by downloading the specific edge driver that matches the version of edge installed on my system. You can find the appropriate driver here:

https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

In my scenario, using Edge version "88.0.705.74", I downloaded the following driver:

After downloading the driver, I extracted it locally. However, when specifying the directory in C#, it required the file name to be "MicrosoftWebDriver.exe" instead of "msedgedriver.exe". I renamed it accordingly:

EdgeOptions options = new EdgeOptions();
IWebDriver edgeDriver = new EdgeDriver("C:\\Users\\[username]\\Downloads\\edgedriver_win64", options);

Now the driver loads successfully, but I encountered a few other errors depending on the machine and account I was operating under. After resolving those issues, I was able to successfully navigate Edge to a page.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I trigger an Onclick event from an <a tag without text in a Javascript form using Selenium?

Here is my original source code: <a onclick="pd(event);" tabindex="0" issprite="true" data-ctl="Icon" style="overflow: hidden; background: transparent url("webwb/pygridicons_12892877635.png!!.png") no-repeat scroll 0px top; width: 16px; height: 16px ...

Utilizing Selenium WebDriver for Automated Testing of Dropdown Menus

When it comes to selecting an option from a dropdown box, there are multiple approaches that can be taken. I have previously used the following method: driver.findElement(By.id("selection")).sendKeys("Germany"); However, this method did not always guaran ...

Begin the execution of JMeter using a JUnit test

Can a recorded JMeter script, used to test the load of multiple user actions, be integrated into a Selenium/JUnit test case? I want to run the Selenium/JUnit test case with Java and receive performance results in the JUnit report, but most resources only ...

Showing ASP.NET Core Action route parameter using AngularJS when the page is loaded

To simplify, I am trying to set it up so that an ID can be caught by Angular if passed as an additional parameter in the Action, or be passed in as a variable. For instance, if my Routing is configured as template: "{action}/{id?}", then someone visiting: ...

An error occurred while executing the TestNG test case due to a java.lang.NullPointerException

Upon attempting to execute this code using TestNG, I am encountering a java.lang.NullPointerException error. Although Firefox successfully launches, the error occurs shortly after. Any insights on what could be causing this issue and how it can be resolv ...

Is there a way to simulate keyboard input in order to paste the current clipboard contents onto a Next.js Ubuntu EC2 instance using Selenium?

Currently, I am attempting to duplicate a text by utilizing an npm package known as "copy-paste" and then inserting the content via selenium keyboard simulation on an Ubuntu EC2 instance running Next.js. Interestingly, the code functions perfectly when ex ...

Utilizing CSS Selectors for Web Scraping with Selenium

Currently, I am working on a college project that involves scraping data from Linkedin. In order to locate the skills & endorsements, recommendations, and accomplishments section, I have implemented the following code: skills = driver.find_elements_by_css_ ...

Determine the quantity of items sharing a common color (CSS attribute)

Can you help me find out the number of web elements in the list "bElements" that have a CSS Color property of "rgba(46, 162, 236, 1)"? I have provided some code below that seems to work, but I'm wondering if there is a more efficient way to achieve th ...

How can I update the browser version in Testcontainers Selenium?

For my Java Integration Tests, I integrate Testcontainers (1.14.1) with Selenium (4.0.0-alpha-5) and Chrome. However, I encountered an issue where my Angular Frontend is not being rendered during test execution. Upon investigation, I discovered that the v ...

Exporting table data to a CSV file using Selenium and Python

My goal is to automate the process of extracting my transcript data and saving it to a CSV file using Python with Selenium. I've managed to automate reaching the table page, however, I am facing an issue where only the first row of the table is displa ...

When attempting to run tests with Chromedriver and Maven, a java.lang.NoSuchMethodError occurs with com.google.common.collect.ImmutableMap

Just starting out with selenium tests and currently following some tutorials on maven via YouTube. Today, I experimented with a few codes which worked fine until I encountered an "Access Denied" message while trying to search for a product on a store page ...

Experiencing difficulty retrieving text using Selenium WebDriver in Python

I am using Selenium WebDriver to extract text from a specific box on this website. Check out my code below: from os import system from selenium import webdriver driver = webdriver.Chrome("./chromedriver") driver.get("http://www.lutanho.ne ...

Choose an option from the dropdown list

When I visit a certain website, there is a drop-down menu labeled "Best Time to Contact." However, when I attempt to click on it, I am unable to make a selection from the drop-down menu. Can someone provide suggestions on how to resolve this issue? from ...

transferring files without a user interface

Looking for a solution to upload a file by clicking on an element: <a class="gray_box" href="#">Choose world folder<span>Select the world folder, we'll do the rest</span></a> The issue arises when the file ...

The connection with Chromedriver is lost unexpectedly due to a KeepAliveFailure occurrence

One challenge I've encountered while running automatic tests for our web application is the random loss of connection to the webdriver. When trying to click an element on the site, the following exception is displayed: OpenQA.Selenium.WebDriverExcept ...

Guide on setting up the sec-ch-ua User-Agent Client Hint in Selenium using Python

I attempted to utilize Selenium in Python to modify User-Agent Client Hint sec-ch-ua, but unfortunately, the code did not produce the intended change. from selenium.webdriver import Chrome from selenium.webdriver.chrome.options import Options sec_ch_ua ...

Experiencing difficulties in sending keys to the search input on Instagram using Python and Selenium

I'm currently working on a Python script that automates logging into Instagram, entering account credentials, and then inputting search keys in the search box. However, after entering the keys, I am unable to submit them which prevents Instagram from ...

Looking for a way to locate an element using Selenium in Python?

import os import selenium from selenium import webdriver import time browser = webdriver.Chrome() browser.get('https://www.skysports.com/champions-league-fixtures') time.sleep(7) #To ensure the page loads completely teamnames = browser.find_elem ...

What is the reason for JsonConvert's distinction between default constructors and parameterized constructors?

While experimenting with Json.net's capabilities to serialize and deserialize dictionaries, I stumbled upon a post on Stack Overflow that provided a helpful solution for simplifying the process. Initially, everything seemed to be working perfectly fi ...

What is the reason behind the successful execution of opt.add_argument('--user-data-dir='+r'path') while opt.add_argument('--user-data-dir='+fr'"{path}"') does not function as a valid option when using Selenium?

While attempting to deploy a chrome driver using --user-data-dir and --profile-directory with the user on Python 3.9.7, I encountered something quite peculiar, as illustrated below: If you run the following code: from selenium import webdriver from seleni ...