Lucy李 发表于 2015-9-25 17:18:10

unexpected alert open

新手,在编代码测试网页的时候处理跳出的窗口,运行时报错说unexpected alert open。这么回事?求帮忙

jingzizx 发表于 2015-9-25 17:18:11

要说清楚怎么处理的

Lucy李 发表于 2015-9-28 08:58:14

jingzizx 发表于 2015-9-25 21:06
要说清楚怎么处理的

要测试的是网页点击一个按钮,然后就会跳出一个小窗口上面有两个按钮,yes 和no 。点击yes就会删除一个东西。我要捕捉到那个窗口然后点击确认,所以代码如下
while (it.hasNext()) {
                        String handle = it.next();
                        if (currentWindow.equals(handle)) continue;
                        WebDriver window = driver.switchTo().window(handle);
                       
                }
                Alert alert = driver.switchTo().alert();
                alert.accept();
                有错吗?
页: [1]
查看完整版本: unexpected alert open