Table of Contents
- How to debug your errors and be self sufficient?
- How can I ask you a question?
- A project with an output Type of class library cannot be started directly
- Unable to copy file … chromedriver.exe
- A exception with a null response was thrown sending an HTTP request… ConnectFailure …
- A exception with a null response was thrown sending an HTTP request to the remote…
- Cannot find Firefox binary in PATH …
- System.SecurityExceptions (multiple options)
- An exception occurred while invoking executor ‘executor://mstestadapter/v2’ …
- System.InvalidOperationException : unknown error: Chrome version must be…
- Issues with Firefox and Selenium 3.0 Compatibility
- Element is not clickable at point (X, Y). Other element would receive the click…
- Unit tests not showing up in Visual Studio test explorer
How to debug your errors and be self sufficient?
Watch this quick video
How can I ask you a question?
Provide me with a SSCCE question in the comments below. I respond daily.
A project with an output Type of class library cannot be started directly
A project with an output Type of class library cannot be started directly. In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.
The problem is that you create a project as a type “Class Library” or “Unit Test Project” and are attempting to execute this project using the key F5, which means “Run”. You cannot run these types of projects in this manner. A unit test project must be executed using the Test Explorer of Visual Studio.
Option 1: In your IDE, go to Test > Windows > Test Explorer. This will open up the Test Explorer. Right click the name of your unit test and then select “Run Selected Tests”.
Option 2: Place the cursor inside of your test method. Press Ctrl + R, T. This will run the test that has the cursor.
This free C# course will teach you how to correctly run the different kinds of projects.
Unable to copy file … chromedriver.exe
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
The process cannot access the file ‘bin\Debug\chromedriver.exe’ because it is being used by another process
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.
- Open Task Manager and kill all chromedriver.exe processes
- Open Powershell command line.
- Execute command: Get-Process chromedriver | Stop-process
- This will kill all processes at once
A exception with a null response was thrown sending an HTTP request… ConnectFailure …
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
Unable to connect to the remote server
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
- Use ChromeDriver for all your test automation practice. Until I tell you it’s okay to use other Drivers.
- Make sure that your Chrome Browser and your ChromeDriver version are compatible.
- You can see this information on the ChromeDriver download page
- 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.
A exception with a null response was thrown sending an HTTP request to the remote…
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.’
Unable to connect to the remote server
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 18.104.22.168
- 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.
Cannot find Firefox binary in PATH …
OpenQA.Selenium.WebDriverException: Cannot find Firefox binary in PATH or default install locations. Make sure Firefox is installed. OS appears to be: Vista
The Selenium Webdriver team is making updates to Selenium to prepare it for Selenium 3.0. Also, the Mozilla team is making changes to the Firefox architecture to support the in built capabilities for Selenium Webdriver. Therefore, working with the latest versions of Selenium Webdriver and Firefox is going to cause you some issues. At least for the next few months. I believe that a stable 3.0 version will be released by Christmas.
You can use the versions that I show in the Complete Selenium Webdriver Course:
- Selenium Webdriver v 2.51.0 – just be sure to select this version in Nuget Package Manager when downloading
- Firefox v 39.0
With the above installed, everything in this course for you should work without problems.
System.SecurityExceptions (multiple options)
Almost any error message that contains SecurityException or something being “Inaccessible”
Here is a specific example that deals with NLog:
Error Error initializing target ‘EventLog Target[eventlog_wrapped]’. Exception: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate)
at System.Diagnostics.EventLog._InternalLogNameFromSourceName(String source, String machineName)
at System.Diagnostics.EventLog.LogNameFromSourceName(String source, String machineName)
at NLog.Targets.Target.Initialize(LoggingConfiguration configuration)
The Zone of the assembly that failed was:
It’s stupid if you ask me, but a certainly recurring problem…
For whatever reason, Visual Studio sometimes requires you to start it as an Administrator. I believe this is after first installation or any kind of modification to Visual Studio.
- Right click your Visual Studio icon
- Select “Run as administrator”
- Perform whatever operation you were previously trying to perform.
- The error should now be fixed
PS. You don’t need to keep running it as Administrator after this. At least it’s a one time action.
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 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:
Now, you will spend the next day wondering how your Selenium code used to work yesterday and today it just stopped working.
Downgrade your appropriate browser to the version supported by the latest Selenium Driver. This might be Firefox, ChromeDriver, IEDriver and so on.
An exception occurred while invoking executor ‘executor://mstestadapter/v2’ …
This message is in your Output pane in “Output from Tests”.
An exception occurred while invoking executor ‘executor://mstestadapter/v2’: Constructor on type ‘Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.UnitTestRunner’ not found.
You are trying to run your Automation tests using MSTest, but they don’t run. They start going, but then Visual Studio just stops. When you check the Output pane, you see the message described above.
MSTest has a bug and needs an update. I had version 1.1.11 installed and it caused me this issue.
- Using NuGet Package manager, update your MSTest.TestAdapter and MSTest.TestFramework NuGet packages to the latest version. I updated to 1.1.18.
- Restart Visual Studio
- Re-run your automation tests
System.InvalidOperationException : unknown error: Chrome version must be…
System.InvalidOperationException : unknown error: Chrome version must be >= 54.0.2840.0
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
Upgrade your Chrome browser to the version supported by ChromeDriver. For example, ChromeDriver 2.27 supports Chrome 54 – 56 according to their release notes.
Issues with Firefox and Selenium 3.0 Compatibility
Nothing specific, if you see weirdness with Firefox and Selenium 3.0, this solution will probably work for you
The #1 problem that people complain about is that their Firefox Driver doesn’t work with Selenium 3.0. I get this question about 72 times per day. Let me help.
The Selenium Webdriver team released Selenium 3.0. However, the Mozilla team is making changes to the Firefox architecture to support the in built capabilities for Selenium Webdriver. Therefore, working with the latest versions of Selenium Webdriver and Firefox is going to cause you some issues until the Firefox team finishes implementing Gecko Driver. By the way, you won’t be using Firefox driver any more.
If you are starting to use Selenium Webdriver, your easiest route is to start by using Chrome Driver. You can use the latest version of Selenium and the latest version of Chrome Driver.
Don’t touch Gecko Driver (replacement of FirefoxDriver) until it is more mature. Otherwise, you’re bound to cause yourself problems.
Element is not clickable at point (X, Y). Other element would receive the click…
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 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 www.ultimateqa.com 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.
To fix this problem, you need to make the element visible. Specifically, the center of the element needs to be clickable as that is where Selenium tries to click. Whether that means scrolling up, or hovering over an element to close it, or clicking on an element that is expanded to minimize it. There are multiple solutions. But simply, make sure that your element is visible for clicking. If there is no element on top of the one you want to interact with, you should be fine.
You can scroll the element into view like this:
Or you can use the actions class to move to element before interacting with it like this:
Unit tests not showing up in Visual Studio test explorer
Something like this below:
- Visual Studio Version: 15.0.X
- MSTest Adapter version: 1.18
There seems to a be bug with Visual Studio and the Visual Studio test adapter when you are trying to work with the versions listed above.
To fix this problem, you need to update Visual Studio to version 15.5.2 and your MSTest Adapter in the Nuget package manager to version 1.2.0.