-
Notifications
You must be signed in to change notification settings - Fork 68
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
fix: WebdriverJS with Safari can cause noSuchWindowException #1027
Conversation
15bd58b
to
21c454e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd want to scope this fix to webdriverjs so it'd only appear in that package changelog i.e. fix(webdriverjs): ...
Left a comment inline
await driver.executeScript(`window.open('about:blank')`); | ||
const handlers = await driver.getAllWindowHandles(); | ||
await driver.switchTo().window(handlers[handlers.length - 1]); | ||
await driver.switchTo().newWindow('tab'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry Scott - this was my mistake I forgot to amend the issue description. There was some discussion offline about switching to using newWindow
. Found that it was only added in Selenium 4 and we do want to continue supporting Selenium 3.
We applied the backwards compatible fix that would work in Selenium 3 and 4 in axe-core-maven-html. For Node it'll be similar
This is the workaround fix that supports Selenium 3 and 4. We would likely switch to #1027 should we drop Selenium 3 support. Rather than always using the last handle after opening a new window, we filter for the unique new handle and use it. This is analogous to the [axe-core-maven-html approach](https://github.com/dequelabs/axe-core-maven-html/blob/ad58b26a8d0e2f1afed33b2c5cbca22b54644b99/selenium/src/main/java/com/deque/html/axecore/extensions/WebDriverExtensions.java#L126). Closes: #936 --------- Co-authored-by: Zidious <[email protected]> Co-authored-by: michael-siek <[email protected]>
Reproing according to the associated issue would occasionally throw a
noSuchWindowException
, about one in three times; this change should fix that.Closes: #936