Skip to content

Conversation

@javier-godoy
Copy link
Member

The current implementation for opening and switching to a new browser window was causing intermittent test failures (flakiness).

((JavascriptExecutor) driver).executeScript("open(arguments[0],arguments[1])",
sideChannelUrl, sideChannelName);
driver.switchTo().window(sideChannelName);

The code was executing window.open() via JavaScript and immediately attempting to switchTo().window(). Because window.open() is handled asynchronously by the browser's UI thread, the WebDriver command to switch would often reach the browser before the browser had finished registering the new window handle.

Result: Selenium would throw an exception because the window name did not exist yet in the session's window list at the server side.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Do

Development

Successfully merging this pull request may close these issues.

2 participants