ITeye博客

selenium 点击alert

mailx8 · 2017-11-28 14:03 · SELENIUM · Web前端 · Markdown

OK, Show you the code:

1 driver.findElement(By.id("updateButton")).click();
2 //pop up with id "updateButton" opens
3 Alert alert = driver.switchTo().alert();
4 //update is executed
5 alert.accept();

如果是点取消,则:

alert.dismiss();

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。