从getWindowHandles()

时间:2015-05-26 10:54:49

标签: java nullpointerexception selenium-chromedriver remotewebdriver

将RemoteWebDriver与ChromeDriver一起使用时,我会在打开新窗口并调用NullPointerException.getWindowHandle()时获得.getWindowHandles()

满足以下条件:

ExpectedCondition<Boolean> windowCondition = new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver driver) {
            return driver.getWindowHandles().size() != windowsBefore;
        }
    };

但是,当调用以下内容时,我会得到NullPointerException

for (String handle : driver.getWindowHandles()) {
        driver.switchTo().window(handle);
    }

在本地运行此脚本时,我没有得到异常!

0 个答案:

没有答案