【Selenium】12Alert
来源:互联网 发布:mysql数据库设计工具 编辑:程序博客网 时间:2024/06/14 10:54
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1><%= title %></h1>
<p>Welcome to <%= title %></p>
<input type="button" onclick="alert('这是Alert');"value="Alert"/>
<br/>
<input type="button" onclick="confirm('这是Confirmation');"value="Confirmation"/>
<br/>
<input type="button" onclick="prompt('这是Prompt');"value="Prompt"/>
<br/>
</body>
</html>
①Accept():点击确定按钮(NoAlertPresentException)
WebElement bnt=driver.findElement(By.xpath("//input[1]"));
bnt.click();
Thread.sleep(3000);
Alert alert=driver.switchTo().alert()
alert.getText();
alert.accept();
②dismiss():点击取消按钮
WebElement bnt=driver.findElement(By.xpath("//input[1]"));
bnt.click();
Thread.sleep(3000);
driver.switchTo().alert().dismiss();
③sendKeys():对prompt有效,输入
WebElement prompt=driver.findElement(By.xpath("//input[1]"));
bnt.click();
Thread.sleep(3000);
driver.switchTo().alert().sendKeys(“”);④getText():弹出文本框文本内容
WebElement prompt=driver.findElement(By.xpath("//input[1]"));
bnt.click();
Thread.sleep(3000);
driver.switchTo().alert().getText(“”);
阅读全文
0 0
- 【Selenium】12Alert
- Selenium 捕获Alert
- selenium之获取alert
- selenium(三)alert
- selenium webdriver处理alert、confirm、prompt
- Selenium webdriver处理alert、confirm弹出框
- selenium之 辨识alert、window以及操作
- selenium之 辨识alert、window以及操作
- Selenium webdriver 处理alert、confirm弹出框
- Selenium FAQ:如何处理JavaScript弹出的alert、prompt窗口
- selenium java等待alert对话框弹出,并关闭对话框
- Selenium对于对话框alert,confirm,prompt的处理
- Selenium3.0 文档——selenium.webdriver.common.alert
- selenium对Alert弹框的多种处理
- 待解决:selenium 未能获取alert!记录,期待大家指导!
- Python+Selenium练习篇之29-处理Alert弹窗
- Phantomjs selenium python爬虫alert confirm 弹窗处理方法
- 5selenium+python 窗口alert跳转 登录成功
- HDU 4180_ RealPhobia (扩展欧几里德定理)
- hdu Hard challenge (几何题)
- 获取选中的option的值
- mybatis 详解(十)------ 逆向工程
- Ionic--lazyload懒加载知识总结
- 【Selenium】12Alert
- Android 相同类,相同包,在不同的jar/aar中,指定引用一个
- JS中 window.location.search的作用
- Ruby操作MongoDB(进阶五)-数据库管理Administration
- K近邻算法
- 走咯~
- React 组件 API
- 网站图片延时加载
- GitHub万星推荐:黑客成长技术清单