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 http://localhost:4723/session timed out after 60 seconds. #89

Closed
lagori opened this issue Sep 25, 2024 · 2 comments · Fixed by #90
Assignees
Labels
bug Something isn't working

Comments

@lagori
Copy link

lagori commented Sep 25, 2024

Hi,

I am trying to do a POC on FlaUI.WebDriver after going through the motivation section in readme.md I am trying to get it work but seems I am missing something in my process. Any guidance and help will be appreciated.

  1. I have cloned the FlaUI.WebDriver repo and have build it using dotnet (.Net 8.0). I have got the FlaUI.WebDriver.exe and able to start the server as in the readme file.
  2. Created a .Net classlib proj with following references :
  1. Created a FlaUIDriverOptions.cs file as mentioned in the readme.md. Created a Test to open notepad and write some text
    [Test]
    public void WriteTest()
    {
    using var driver = new RemoteWebDriver(new Uri("http://localhost:4723"), FlaUIDriverOptions.ForApp("C:\Program Files\WindowsApps\Microsoft.WindowsNotepad_11.2407.9.0_x64__8wekyb3d8bbwe\Notepad\Notepad.exe"));
    driver.FindElement(By.Name("Text editor")).SendKeys("Hello world!!!");
    }

Running the test is failing with the following error -

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Failed WriteTest [1 m]
Error Message:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:4723/session timed out after 60 seconds.
----> System.Threading.Tasks.TaskCanceledException : The request was canceled due to the configured HttpClient.Timeout of 60 seconds elapsing.
----> System.TimeoutException : The operation was canceled.
----> System.Threading.Tasks.TaskCanceledException : The operation was canceled.
----> System.IO.IOException : Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
----> System.Net.Sockets.SocketException : The I/O operation has been aborted because of either a thread exit or an application request.
Stack Trace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.ExecuteAsync(Command commandToExecute)
at OpenQA.Selenium.WebDriver.ExecuteAsync(String driverCommandToExecute, Dictionary2 parameters) at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary2 parameters)
at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities capabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities capabilities, TimeSpan commandTimeout)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, ICapabilities capabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(Uri remoteAddress, DriverOptions options)
at FlaSelOne.NotepadTests.WriteTest() in D:\KitePack\POC\CS\FlaUISelenium\FlaSelOne\NotepadTests.cs:line 14
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--TaskCanceledException
at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.ExecuteAsync(Command commandToExecute)
--TimeoutException

--TaskCanceledException
at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
--IOException
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.Net.Http.HttpConnection.InitialFillAsync(Boolean async)
at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--SocketException

Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: 1 m - FlaSelOne.dll (net8.0)

The FlaUI.WebDriver.exe has the following error -
image

It opens the Notepad app but the driver is not able to get instantiated. I tried using different apps like Calculator, Warehouse management app etc .. but get to the same problem.
Any help is appreciated.

Many Thanks,
ARKK

aristotelos added a commit that referenced this issue Sep 26, 2024
Return a clear error response when loading the main window fails within
the page load timeout. Fixes #89.
@aristotelos
Copy link
Collaborator

Hi @lagori,

Thank you for logging this issue.

Launching UWP apps requires the appium:app to be set to <package family name>!App, because it launches a different process underneath and closes the initial process.

I will also try to improve the error handling for this unhandled exception so that it is a little more clear what is happening: it cannot find the main window for this app.

@aristotelos aristotelos added the bug Something isn't working label Sep 26, 2024
@aristotelos aristotelos self-assigned this Sep 26, 2024
@aristotelos aristotelos linked a pull request Sep 26, 2024 that will close this issue
aristotelos added a commit that referenced this issue Sep 26, 2024
Return a clear error response when loading the main window fails within
the page load timeout. Fixes #89.
@lagori
Copy link
Author

lagori commented Sep 26, 2024

Thanks @aristotelos I am now able to launch the app and do the desired actions. Many Thanks. Also I found a link to download the exe assets. [https://github.com/FlaUI/FlaUI.WebDriver/releases] I guess adding this link in the readme.md will help people to download directly rather than building the project locally. Thanks again for your prompt response.

aristotelos added a commit that referenced this issue Sep 27, 2024
Return a clear error response when loading the main window fails within
the page load timeout. Fixes #89.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants