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

fix: WebdriverJS with Safari can cause noSuchWindowException #1027

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions packages/webdriverjs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,7 @@ export default class AxeBuilder {
await driver.switchTo().window(win);

try {
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');
Copy link
Contributor

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

await driver.get('about:blank');
} catch (error) {
throw new Error(
Expand Down
Loading