OpenQA.Selenium.WebDriverException while creating an object for Windows Driver
See original GitHub issueI 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:
- Added WinAppDriver to the Firewall exception list.
- 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:
- Created 3 years ago
- Comments:7
Top GitHub Comments
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.
Nothing wrong with your code, what is the value of IsKeyboardFocusable: in inspect.