Skip to content
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

OpenQA.Selenium.WebDriverException The HTTP request to the remote WebDriver server for URL timed out after 60 seconds. #1976

Open
shyampatadia opened this issue Feb 19, 2024 · 5 comments

Comments

@shyampatadia
Copy link

Hello guys, I recently started using WinAppDriver, I am facing a issue of timeout exception, whenever trying to find a certain element.

I am using WinAppDriver with Specflow, Appium and Selenium.

Now In the scenario "A", the driver is able to find the element of the Search bar present in the task bar of Windows 11. Now when I run the same thing in scenario "B", it gives me the exception that I mentioned. The element is same, the workflow is same, everything is same only that the scenario is different, and I am using hooks so the specflow hooks are also the same. Can anyone help me out if you have faced a similar issue?

Below is the Stack of the exception:

OpenQA.Selenium.WebDriverException The HTTP request to the remote WebDriver server for URL http://127.0.0.1:4723/session/94514B13-90D8-4D25-B6F2-4656280AC515/element timed out after 60 seconds. at OpenQA.Selenium.Appium.Service.AppiumCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Appium.AppiumDriver1.FindElement(String by, String value) at OpenQA.Selenium.Appium.AppiumDriver1.FindElementByAccessibilityId(String selector)
`

Below is the log from the Console of the WinAppDriver.exe:
`
POST /session/94514B13-90D8-4D25-B6F2-4656280AC515/element HTTP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 33
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-891dadc9e7372967c7686d3a170c1518-678ffb6acf2376ff-00
User-Agent: selenium/3.141.0 (.net windows)

{"using":"name","value":"Search"}
`

Below are the versions of the Nugget packages in the project:
<PackageReference Include="Appium.WebDriver" Version="4.1.1" /> <PackageReference Include="Selenium.Support" Version="3.141.0" /> <PackageReference Include="Selenium.WebDriver" Version="3.141.0" /> <PackageReference Include="SpecFlow" Version="3.4.8" /> <PackageReference Include="SpecFlow.xUnit" Version="3.4.8" />

Below is the code for the driver initialization:
Process.Start(@winappDriverExecutablePath); AppiumOptions appiumOptions = new AppiumOptions(); appiumOptions.AddAdditionalCapability("app", "Root"); _deskTopDriver = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appiumOptions);

@anunay1
Copy link

anunay1 commented Feb 19, 2024

Try getting the page source.

@shyampatadia
Copy link
Author

shyampatadia commented Feb 20, 2024

Still its giving the same issue
var pageSource = _desktopDriver.PageSource;
I added the above line it gave me the same exception, I have captured the console API requests made to the WinAppDriver:

`POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/element HTTP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 34
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-e3b44cb981640b414606c9e4200c86cc-63b8f4b8fb7e4009-00
User-Agent: selenium/3.141.0 (.net windows)

{"using":"name","value":"Taskbar"}
HTTP/1.1 200 OK
Content-Length: 95
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0,"value":{"ELEMENT
":"42.196772"}}

==========================================
POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/element/42.196772/element HTT
P/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 32
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-49cdb9f1f4e0a2c0934abce9c82a4077-026d436848f3affa-00
User-Agent: selenium/3.141.0 (.net windows)

{"using":"name","value":"Start"}

HTTP/1.1 200 OK
Content-Length: 99
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0,"value":{"ELEMENT
":"42.66270.4.35"}}

==========================================

POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/element/42.66270.4.35/click H
TTP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 2
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-b428a62eb2d370c7106c6b463c2902d4-2c52af8694a18591-00
User-Agent: selenium/3.141.0 (.net windows)

{}
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0}

==========================================
POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/element HTTP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 57
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-1129461328265a949e4ef54086306c7a-e2abb73bf47f50c0-00
User-Agent: selenium/3.141.0 (.net windows)

{"using":"accessibility id","value":"StartMenuSearchBox"}
HTTP/1.1 200 OK
Content-Length: 98
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0,"value":{"ELEMENT
":"42.66078.4.3"}}

==========================================

POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/element/42.66078.4.3/value HT
TP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 183
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-0b10630f6b4a5eee3034ab5b788a884b-870978bc4a6762aa-00
User-Agent: selenium/3.141.0 (.net windows)

{"value":["PATH\Resources\FileUploadExe\MTP.docx"]}
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0}

==========================================
POST /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/keys HTTP/1.1
Accept: application/json, image/png
Connection: Keep-Alive
Content-Length: 17
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
traceparent: 00-449057c1ee08df4aba6521807249e7da-91fce5246835dafc-00
User-Agent: selenium/3.141.0 (.net windows)

{"value":[""]}
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json

{"sessionId":"9DCFA9B5-8698-4016-952C-3D8AABCE56F7","status":0}

==========================================
GET /session/9DCFA9B5-8698-4016-952C-3D8AABCE56F7/source HTTP/1.1
Accept: application/json, image/png
Cache-Control: no-cache
Connection: Keep-Alive
Host: 127.0.0.1:4723
traceparent: 00-8c87898d069d49c8305f62c05c4d6222-414cb39b9a5bca1b-00
User-Agent: selenium/3.141.0 (.net windows) `

@anunay1
Copy link

anunay1 commented Feb 20, 2024

Dude, you need to store the page source to a log file or text file and check if the page source contains the element.

@shyampatadia
Copy link
Author

Yes, I tried the same, the element is present in the Page Source, but still getting the same exception. Even I tried increasing the Implicit wait while initializing the driver but still the issue is persistent. Do you know any other work around for this?

@anunay1
Copy link

anunay1 commented Feb 20, 2024

That's strange will it be possible to share any screen recording?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants