Here you will find the most common Selenium WebDriver errors and the solutions to those errors. Enjoy 👍

Selenium C# errors

Element is not clickable at point (X, Y). Other element would receive the click…

Error Message

System.InvalidOperationException : unknown error: Element is not clickable at point (111, 700). Other element would receive the click: <div class=”et_social_heading”>…</div>  (Session info: chrome=45.0.2454.93)  (Driver info: chromedriver=2.15.322448 (52179c1b310fec1797c81ea9a20326839860b7d3),platform=Windows NT 6.1 SP1 x86_64)

The Problem

The problem here is that the element that you are trying to click is either covered by another element, or simply not visible. Here is an example. If you go to ultimateqa.wpmudev.host and try to click the Start Here button when you are a bit scrolled down, the header covers up the button. As a result, even though the button is on the page, it is not clickable because the header is covering it up.

Element not clickable example
Element not clickable example

The Solution

To fix this problem, you need to make the element visible. Specifically,  Selenium tries to click on the exact center of the element. Your options are to scroll up, or hover over an element to close it, or minimize an expanded element. Simply put, make sure that your element is visible for clicking. The center of the element that you want to interact with should not be obstructed by another element.

You can scroll the element into view like this:

https://gist.github.com/nadvolod/2c5ce6c43b44fc2dc2a17cb34531597d

Or you can use the actions class to move to element before interacting with it like this:


There is already an option for the browserVersion capability. Please use the instead.

Error Message

System.ArgumentException: ‘There is already an option for the browserVersion capability. Please use the  instead.

Parameter name: capabilityName’

The Problem

With the introduction of the W3C spec, there will be changes to the DriverOptions.cs from Selenium. This means that the old way of setting the ChromeOptions or DesiredCapabilities will no longer be possible. So this will be a new way to make this happen.

The Solution

Set your DriverOptions through properties instead of passing in strings into the AddAdditionalCapability()

Here’s a code sample for C# and setting ChromeOptions:

Btw, if you’re struggling with Selenium and need my favorite resources, you might want to check these out.


Feel like your automation could be better?
Get a second pair of eyes on your automation.


Unable to copy file … chromedriver.exe

Error Message

Severity Code Description Project File Line Suppression State
Error Unable to copy file “C:\Users\User\Documents\Visual Studio 2015\Projects\UnitTestProject5\UnitTestProject5\chromedriver.exe” to “bin\Debug\chromedriver.exe

InnerException

The process cannot access the file ‘bin\Debug\chromedriver.exe’ because it is being used by another process

The Problem

The problem here is that your ChromeDriver is being used by another process. So when it’s trying to be copied, it can’t because it’s being used.

The Solution

Option A

  1. Open Task Manager and kill all chromedriver.exe processes

Option B

  1. Open Powershell command line.
  2. Execute command: Get-Process chromedriver | Stop-Process
  3. This will kill all processes at once

An exception with a null response was thrown sending an HTTP request… ConnectFailure …

Error Message

A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:19409/session/7114d633a2adbc5105f3f6c7abc7c596/url. The status of the exception was ConnectFailure, and the message was: Unable to connect to the remote server

InnerException

Unable to connect to the remote server

The Problem

Compatibility of Selenium WebDriver with a browser is the culprit here. This is the largest burden in my behind, and has been for years now…

This will probably continue until Selenium WebDriver is a W3C standard that is integrated into each browser. Until then, we will keep having these issues.

This error occurred to me with:

  • Chrome 55,56
  • ChromeDriver 2.27
  • Selenium WebDriver 3.0.1

The Solution

  1. Use ChromeDriver for all your test automation practice. Until I tell you it’s okay to use other Drivers.
  2. Make sure that your Chrome Browser and your ChromeDriver version are compatible.
    • You can see this information on the ChromeDriver download page
How to tell if ChromeDriver is compatible with Chrome Browser
How to tell if ChromeDriver is compatible with Chrome Browser

Upgrade your Chrome and your ChromeDriver if you must

  • Warning: It’s almost impossible to downgrade ChromeDriver, so don’t try

Download the latest Selenium WebDriver API Nuget package Rebuild your whole solution with all of these new resources Try to run your tests again

  • If this doesn’t work, restart your computer and try again.
How to fix common Selenium errors? Share on X

An exception with a null response was thrown sending an HTTP request to the remote…

Error Message

Similar to the error above, but it’s slightly different in wording and message.

Selenium.WebDriverException: ‘A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:25675/session. The status of the exception was ReceiveFailure, and the message was: The underlying connection was closed: An unexpected error occurred on a receive.’

InnerException

Unable to connect to the remote server

The Problem

You may have noticed that this page has one trend. Compatibility of Selenium WebDriver with a browser. This the largest burden in many of my behind, and has been for years now. This will probably continue until Selenium WebDriver is a W3C standard that is integrated into each browser. Until then, we will keep having these issues.

This error occurred to me with:

  • Chrome 56
  • ChromeDriver 2.27
  • Selenium WebDriver 3.0.1.0

The Solution

  • Update your Chrome browser to version 57.0
  • This did the trick for me. Keep in mind that maybe your versions of browser and ChromeDriver may be different. However, if you receive this error, just upgrade your browser until it fits into the support matrix of ChromeDriver release logs.

System.TypeInitializationException

System.TypeInitializationException: System.TypeInitializationException: The type initializer for ‘Framework.Browser’ threw an exception. —> OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000 ms. Attempted to connect to the following addresses: 127.0.0.1:7055.

Or something like this?

OpenQA.Selenium.WebDriverException : Unexpected error. System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it

Today is your lucky day because I am going to help you resolve these really annoying errors!

The Problem

The problem is a standard compatibility issue between Selenium WebDriver and your version of a browser. As I am writing about this, the latest WebDriver version is 2.53.1. The latest Chrome version is 51.0 and the latest Firefox version is 46.0. Therefore, the Selenium WebDriver API does not get updated as often as Chrome or Firefox.

When different types of browsers such as Chrome or Firefox get updated, there is a chance that this update will break the Selenium API.

In our industry, this is known as a regression. Therefore, when you get the latest version of your browser, you may be using a Selenium WebDriver version that does not support the latest features of that browser. At this point, you will receive an ugly error that looks like this:

System.TypeInitializationException

Now, you will spend the next day wondering how your Selenium code used to work yesterday and today it just stopped working.

The Solution

Downgrade your appropriate browser to the version supported by the latest Selenium Driver. This might be Firefox, ChromeDriver, IEDriver and so on.

In this example I teach you how to downgrade Firefox.


System.InvalidOperationException : unknown error: Chrome version must be…

Error Message

System.InvalidOperationException : unknown error: Chrome version must be >= 54.0.2840.0

The Problem

Another issue with compatibility of ChromeDriver with Chrome Browser. In this case it was Chrome version 48.0 not working with ChromeDriver version 2.27

The Solution

Upgrade your Chrome browser to the version supported by ChromeDriver. For example, ChromeDriver 2.27 supports Chrome 54 – 56 according to their release notes.


Could not copy “C… chromedriver.exe” to {some path}..

Error message

Could not copy file “C:\…chromedriver.exe” to “…\chromedriver.exe

Solution

See this error above “Unable to copy file … chromedriver.exe”. It’s the same exact problem


Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly… for a driver

The solution

Is here


ExpectedConditions’ is obsolete: ‘ implementation… deprecated

Error message

ExpectedConditions’ is obsolete: ‘The ExpectedConditions implementation in the .NET bindings is deprecated and will be removed in a future release. This portion of the code has been migrated to the DotNetSeleniumExtras repository on GitHub (https://github.com/DotNetSeleniumTools/DotNetSeleniumExtras)’

The problem

Winter is coming! And so is Selenium 4.0 🙂 That’s exciting news because it means that it’s getting better. However, this also means that there are some things that will be deprecated. ExpectedConditions.cs will be moving to a different Nuget package. Right now, if you are using Selenium 3.X, this is just a warning. Later, you will not be able to do this.

The Solution

I outlined the solution in depth here


NoSuchElementException: no such element: Unable to locate element

Error message

OpenQA.Selenium.NoSuchElementException: no such element: Unable to locate element: {“method”:”partial link text”,”selector”:”Master Automation With Selenium”}
(Session info: chrome=81.0.4044.138)
(Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.18362 x86_64)

The problem

The element cannot be found on the page. This can happen when you are using an incorrect locator for your element, or when the element has not been yet loaded on the page.

The Solution

This problem has two possible solutions:

Solution A

If the problem is that the locator is incorrect, try using a different locator (by Id, Name, Xpath etc) and make sure that the locator corresponds to a single element on the page.

Solution B

If the problem is related to the loading time, add a wait, so Selenium will wait a few seconds before throwing the exception if the element is not found.

  • Implicit wait (not really recommended)
WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(5));

Or

Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
  • Explicit wait

First, download the DotNetSeleniumExtras.WaitHelpers Nuget package.
Add this using statement to your class:

using ExpectedConditions = SeleniumExtras.WaitHelpers.ExpectedConditions;

Then add the explicit wait to your method:

WebDriverWait _wait =  new WebDriverWait(Driver, TimeSpan.FromSeconds(5));
_wait.Until(ExpectedConditions.ElementIsVisible(locator));

You can find more information on using the Explicit wait here.


Selenium Java Errors

Error:java: error: release version 5 not supported

The solution


java.lang.IllegalStateException: The driver is not executable: …/chromedriver

Error Message

java.lang.IllegalStateException: The driver is not executable: /Users/nikolayadvolodkin/Documents/source/java/selenium-java/resources/mac/chromedrive

The Problem

The issue is that you need to download the correct Chromedriver version for your OS

The Solution

The solution is here, see my comment in SO as well.


“chromedriver” cannot be opened because the developer cannot be verified.

Error Message

“chromedriver” cannot be opened because the developer cannot be verified.

The Problem

Mac OS security stuff…

The Solution

The solution is on SO. Either answer 1 or 2 will fix this


The driver executable does not exist

Error Message

“The driver executable does not exist”.

The Problem

(1) The path of the file may not be correct or (2) chrome driver may not be compatible with your chrome browser.

The Solution

  1. Copy into your local file the following paths:

Path for Mac:

System.setProperty("webdriver.chrome.driver", "resources/mac/chromedriver")

Path for Windows:

System.setProperty("webdriver.chrome.driver", "resources/windows/chromedriver.exe");

2. Make sure that you download the correct version of chromedriver to your machine depending on your OS: Download here.


Selenium Java Errors – Maven errors

[ERROR] Source option X is no longer supported. Use Y or later.

Error Message

For this we will use for example X being version 1.5 and Y being version 1.6:

[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.

The Solution

Need to set your maven.compiler.source to at least 1.6

<properties> 
<maven.compiler.source>1.6</maven.compiler.source> 
<maven.compiler.target>1.6</maven.compiler.target> 
</properties>

Solution 2

You might need to add the Maven compiler plugin to your POM.xml. Make sure that you set the correct source and target based on your JDK.

Btw, if you’re struggling with Selenium and need my favorite resources, you might want to check these out.


Cannot start compilation: the output path is not specified for module “xyz” Specify the output path in Configure Project.

Error Message

Cannot start compilation: the output path is not specified for module "xyz" Specify the output path in Configure Project.

The Problem

The issue is that you need to set an output path in your Intelli J.

The Solution

You have 2 options here

I was able to resolve this problem by setting a path in the Project compiler output. I simply create an `out` folder in my parent directory and specified the path to point to this directory.


Could not create a session: You must enable the ‘Allow Remote Automation’ option in Safari’s Develop menu

Error Message

org.openqa.selenium.SessionNotCreatedException: Could not create a session: You must enable the ‘Allow Remote Automation’ option in Safari’s Develop menu to control Safari via WebDriver.

Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’

Driver info: driver.version: SafariDriver

The Solution

We need to enable Allow Remote Automation in Safari like this


Visual Studio Errors

If you are using Visual Studio with C# and MsTest for your Selenium automation, you can find common Visual Studio error here.


Miscellaneous Errors

Mac/Linux is not returning environment variable values from terminal

Error Message

When trying to read environment variables from your test code like this

protected static final String SAUCE_USERNAME = System.getenv("SAUCE_USERNAME");

Or even trying to read it in terminal like this

echo $SAUCE_USERNAME

the string comes back as empty.

The Solution

If your variables are stored in ~/.bash_profile then you need to make sure that your default terminal shell is bash and not something else.

Follow these steps:

//1. check your default shell in a terminal
echo $0

if it doesn’t say bash then we need to change it

//2. get the path of your bash
type -a bash
// bash is /bin/bash

then change to bash using the location from above

chsh -s /bin/bash

close and then reopen the terminal and rerun your commands to access the variables.

Summary

Hope this was helpful?

Is there an error that you need help resolving? Please comment below and I’ll try to resolve it for you.


Feel like your automation could be better?
Get a second pair of eyes on your automation.