2

I have noticed in my testing that sometimes I get "System.Net.WebException: Unable to connect to the remote server" when running tests in Selenium. It appears to happen randomly, but specifically when running multiple tests at the same time.

My current test set up is using Specflow + specrun. Each test creates a new web driver. Usually there are ~8 test threads running. This error will show up 2-3 times for every 100 tests run.

Has anyone seen this, and does anyone have an idea how to resolve it? My guess is that some other test is already using the same port that the driver is trying to run on, or something similar to that. Anyone know a good way to prevent that?

asked Aug 26, 2016 at 19:08
4
  • What are your versions? browser and selenium Commented Aug 26, 2016 at 19:47
  • Selenium 2.53.1 + PhantomJS 2.1.1 and ChromeDriver 2.23 Commented Aug 26, 2016 at 20:13
  • Usually those issues are related to Connectivity/network/domain; have all of these been accounted for? Commented Aug 26, 2016 at 20:16
  • Not sure what you mean by that. Any advice on how to ensure that's not the issue? Commented Aug 26, 2016 at 20:20

2 Answers 2

2

Have a look this, or read this:

  • You are running the test suite twice
  • You are not releasing the connection after each run
  • The test suite crashed and is still running in the background
  • Something else is running on your computer and using that port
alecxe
11.4k11 gold badges52 silver badges107 bronze badges
answered Aug 29, 2016 at 4:28
1
  • Do you have any idea how to get around the error when running tests in parallel? It seems the issue is that when I run my test suite, it is launching ~8 drivers at a time, which causes this issue to come up. Running the tests one at a time would be too slow. Commented Aug 29, 2016 at 13:56
0

Kill the driver instance in cleanup.

You must have made the driver instance static and have not driver.Quit() after the run, so its retailing the instance and not allowing new chromedriver instance to launch.

answered Sep 27, 2019 at 5:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.