JavaScript 有三种弹窗 Alert (只有确定按钮), Confirmation (确定,取消等按钮), Prompt (有输入对话框)。
1.accept()相当于点击弹出框的确定按钮:driver.switchTo().alert().accept();
2.dismiss()相当于点击弹出框的取消按钮:driver.switchTo().alert().dismiss();
3.SendKeys(String input)针对于prompt情况的输入:driver.switchTo().alert().sendKeys("可以输入");
4.getText()获取弹出框文本内容:driver.switchTo().alert.getText();
网友评论