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

Access web driver's properties only in try-catch #1267

Merged
merged 2 commits into from
Sep 14, 2024

Conversation

ilonatommy
Copy link
Member

Found on dotnet/runtime#107795.
Accessing WindowHandles when the browser is disconnected will always result in exception. We have to move all code that accesses it to try-catch. The code in try is the cleanup code, so it's fine if we enter it on disconnected driver.

Error being fixed:
log

[15:41:09] fail: Application has finished with exit code TIMED_OUT but 0 was expected
[15:41:09] crit: OpenQA.Selenium.WebDriverException: An unknown exception was encountered sending an HTTP request to the remote WebDriver server for URL http://localhost:33861/session/73a9a014d272c52eab96971e91026f34/window/handles. The exception message was: Connection refused (localhost:33861)
                  ---> System.Net.Http.HttpRequestException: Connection refused (localhost:33861)
............
at OpenQA.Selenium.Remote.RemoteWebDriver.get_WindowHandles()
                    at Microsoft.DotNet.XHarness.CLI.Commands.Wasm.WasmTestBrowserCommand.InvokeInternal(ILogger logger) in /_/src/Microsoft.DotNet.XHarness.CLI/Commands/WASM/Browser/WasmTestBrowserCommand.cs:line 108
                    at Microsoft.DotNet.XHarness.CLI.Commands.XHarnessCommand`1.Invoke(IEnumerable`1 arguments) in /_/src/Microsoft.DotNet.XHarness.CLI/Commands/XHarnessCommand.cs:line 145

@ilonatommy ilonatommy self-assigned this Sep 13, 2024
@ilonatommy
Copy link
Member Author

/ba-g android failures not related

@ilonatommy ilonatommy merged commit 9a7efc6 into dotnet:main Sep 14, 2024
15 of 17 checks passed
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

Successfully merging this pull request may close these issues.

4 participants