-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[🐛 Bug]: No connection could be made because the target machine actively refused it. #12114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Pandzioch, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
Why are you setting these if there is no proxy on the machine?
The only supported means in Selenium to pass proxy information is with the Further, Finally, in order to consider this issue a bug, we need a minimal reproducible example |
Hi, @Pandzioch. Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue. Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough. Reply to this issue when all information is provided, thank you. |
@titusfortner I took my time to work with those waiting methods and removed DotNetSeleniumExtras NuGet (this also goes for SeleniumExtras.WaitHelpers). I wish I could give You a straight copy-paste of the code, but as I've mentioned before that cannot be done. |
So moving to anonymous functions fixed your problem? If you don't still have an problem, I wouldn't spend time trying to figure out why you had it. We can close this issue and have another example of why people should avoid expected conditions classes. |
So that method sometimes throws a socket exception.... I can't remember if that error is essentially a kind of timeout. Are you running multiple tests in parallel? Is the system under test overtaxed? |
Tests are running as nonparallel due to the usage of SpecFlow as a BDD overlay. At the moment of the run, I was the only person using it at the time. I've changed the method for invisibility of the element to:
Which seems to be working fine (at least for now). But I kinda don't understand the message here because: |
Yeah, this seems like some kind of network issue. The question is whether it is immediately throwing the error or if there is some time it is waiting and then throwing the error. If there is a time difference, is the problem that the difference isn't enough time given, or would it always fail, regardless. I'm not sure how to debug this one more. |
Based on my personal experience, for most of the runs, the issue occurred on a slight timeout, around 3-4 seconds. It looks like waiting and then throwing an error. Anyway, I really appreciate Your time Titus, thanks for looking at it. |
We're going to be talking more about this going forward. I'm hoping for Selenium 5 to take the approach that .NET did and move some of these helper libraries outside of Selenium proper for all the languages. |
errors with me ---> (Inner Exception #2) OpenQA.Selenium.WebDriverException: An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://localhost:52849/session. The exception message was: An error occurred while sending the request. |
This could be a session trying to access a driver that was closed by a previous session. I'd check to see how things are running in parallel, or if there are any proxy issues. Make sure you are using latest Selenium. Not sure what else to suggest. |
Yes, i use newest, with connect remote debug port not direct open from selenium, i dont use proxy, error realease after 30- 40 times run,i reused the port after each session (port is calculated by thread, i close the browser then open a new one), i think this might be the problem |
The request was canceled due to the configured HttpClient.Timeout of 5 seconds elapsing is there any way to increase this timeout, i see default httpclient is 100s |
If the driver were running on that port, the connection would happen in milliseconds. That timeout is not the problem. |
Note: this is the connection timeout not the read timeout |
Well, I'll try to respond due to some similarities to my own problem. I discovered it after a while after posting this thread. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What happened?
Hi dear developers.
So what I currently struggle with is a problem with C# Selenium with SocketException for ChromeDriver:
I've done some digging into this to actually find what's wrong.
Setup of the test is pretty straightforward, driver is being initialized with ChromeOptions:
"--start-maximized",
"--no-sandbox",
"--proxy-server='direct://'",
"--proxy-bypass-list=*",
This error occurs not only on CI/CD but my local machine also, what's worth mentioning is that for 60+ automated test cases, the error comes usually once per run.
Configuration setup looks like this:
I've tried all the solutions I could find by searching all across the internet by found no good.
What's even funnier, the downgrade from .NET 6.0 to .NET 5.0 project reduced this error by a lot (From 3-4 crashes to 1 or none)
How can we reproduce the issue?
Relevant log output
Operating System
Windows 10, Windows Server 2016 Standard
Selenium version
C# Selenium.WebDriver 4.9.1, NUnit 3.13.3, NUnit3TestAdapter 4.4.2
What are the browser(s) and version(s) where you see this issue?
GoogleChrome 113.0.5672.127 (64-bit)
What are the browser driver(s) and version(s) where you see this issue?
Selenium.WebDriver.ChromeDriver 113.0.5672.6300
Are you using Selenium Grid?
No
The text was updated successfully, but these errors were encountered: