So, this was a strange one. The way we were opening about:blank and handles was a bit strange. Using the Safari driver going to any website would would cause NoSuchWindowException error. This would consistently throw when testing locally. After some digging, it appears when we called driver.executeScript("window.open('about:blank', '_blank')"); and attempt to switchTo() to the new window it would cause open the about:blank page and cause the current handle (the page being analyzed) to also navigate to the about:blank page, it appears the window handle would reference itself and not the newly opened page.
To avoid doing executeScript and checking window handles, we can simply lean on Selenium for switching to a new window that is a tab and safely navigate to about:blank.
I also noticed WebDriverExtensionsTest.java was missing a tests, so I added some there.
So, this was a strange one. The way we were opening
about:blank
and handles was a bit strange. Using the Safari driver going to any website would would causeNoSuchWindowException
error. This would consistently throw when testing locally. After some digging, it appears when we calleddriver.executeScript("window.open('about:blank', '_blank')");
and attempt toswitchTo()
to the new window it would cause open theabout:blank
page and cause the current handle (the page being analyzed) to also navigate to theabout:blank
page, it appears the window handle would reference itself and not the newly opened page.To avoid doing
executeScript
and checking window handles, we can simply lean on Selenium for switching to a new window that is a tab and safely navigate toabout:blank
.I also noticed
WebDriverExtensionsTest.java
was missing a tests, so I added some there.Closes: https://github.com/dequelabs/axe-core-maven-html/issues/391