question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenQA.Selenium.WebDriverException while creating an object for Windows Driver

See original GitHub issue

I am facing “OpenQA.Selenium.WebDriverException” very frequently when I execute the unit test. I had executed WinAppDriver.exe with admin rights and when I execute the unit test it throws an exception. This exception is primarily observed after adding the Desired Capabilities. Below is the code snippet where this exception is observed.

AppiumOptions capabilities = new AppiumOptions(); capabilities.AddAdditionalCapability("app", "Root"); WindowsDriver<WindowsElement> localSession = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), capabilities);

Issue is observed when creating WindowsDriver object.

Exception Details: OpenQA.Selenium.WebDriverException: ‘Unexpected error. System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 127.0.0.1:4723 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) — End of inner exception stack trace — at OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)’

NOTE:

  1. Added WinAppDriver to the Firewall exception list.
  2. It opens the application but throws the above exception on line where we create object localSession.

Kindly let me know where the issue is and how do I fix it permanently. I am new to Automation Development environment.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
MahVercommented, Jul 3, 2020

Thanks @anunay1 for pointing out to this. The IsKeyboardFocusable property is True but it was my mistake that I accidentally moved the mouse pointer before it tracks and clicks the menu item.

0reactions
anunay1commented, Jul 3, 2020

Nothing wrong with your code, what is the value of IsKeyboardFocusable: in inspect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenQA.Selenium.WebDriverException: 'Cannot start the ...
As for this issue, It could be the case that a process of the WebDriver is still running in the background. Please try...
Read more >
Use org.openqa.selenium.WebDriverException in JUnit ...
The WebDriver error - unknown error, happens when the driver tries to process a command and an unspecified error occurs. The error can...
Read more >
Use org.openqa.selenium.WebDriverException.addInfo in ...
The WebDriver error - unknown error, happens when the driver tries to process a command and an unspecified error occurs. The error can...
Read more >
Unable to Locate Driver Error
This error means the necessary driver could not be found by any of the means Selenium attempts to use.
Read more >
Top 10 Selenium Exceptions and How To Handle These ...
Handling Exceptions in Selenium WebDriver - In this tutorial we will learn about types of exceptions and how to handle top 10 most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found