java_java selenium操作弹出对话框示例讲解,Web 开发人员通常需要利用JavaSc
错误或警告等 2. 提示框: 用于提示用户在当前对话框中输入数据,一般需要用户单击取消或者确认按钮 测试页面 用如下页面为例进行讲解,提示框,确认框 Selenium 操作对话框的代码 public static void testAlert(WebDriver driver) { String url="http://sislands.com/coin70/week1/dialogbox.htm"; driver.get(url);WebElement alertButton = driver.findElement(By.xpath("//input[@value='alert']")); alertButton.click();Alert javascriptAlert = driver.switchTo().alert(); System.out.println(javascriptAlert.getText()); javascriptAlert.accept(); }public static void testPrompt(WebDriver driver) throws Exception { String url="http://sislands.com/coin70/week1/dialogbox.htm"; driver.get(url);WebElement promptButton = driver.findElement(By.xpath("//input[@value='prompt']")); promptButton.click(); Thread.sleep(2000); Alert javascriptPrompt = driver.switchTo().alert(); javascriptPrompt.sendKeys("This is learning Selenium"); javascriptPrompt.accept();System.out.println(javascriptPrompt.getText());javascriptPrompt=driver.switchTo().alert(); javascriptPrompt.accept();Thread.sleep(2000); promptButton.click(); javascriptPrompt=driver.switchTo().alert(); javascriptPrompt.dismiss(); Thread.sleep(2000); javascriptPrompt=driver.switchTo().alert(); javascriptPrompt.accept(); }public static void testConfirm(WebDriver driver) throws Exception { String url="http://sislands.com/coin70/week1/dialogbox.htm"; driver.get(url);WebElement confirmButton = driver.findElement(By.xpath("//input[@value='confirm']")); confirmButton.click(); Thread.sleep(2000); Alert javascriptConfirm = driver.switchTo().alert(); javascriptConfirm.accept(); Thread.sleep(2000); javascriptConfirm = driver.switchTo().alert(); javascriptConfirm.accept(); } 以上就是对 java selenium操作弹出对话框的资料整理,一般需要用户单击取消或者确认按钮 3. 确认框: 用于提示用户确认或者取消某个操作,谢谢大家对本站的支持! , 包括了警告框, Selenium 操作对话框的代码 对话框类型 1. 警告框: 用于提示用户相关信息的验证结果,后续继续补充,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jiaob/java/12230.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
Fitness fitness){ /*double X1=m
时间:2021-01-21
-
所以这里也是需要注意的
时间:2021-01-21
-
hadoop上传文件成果实例代
时间:2021-01-15
-
hadoop负责按key值将map的输
时间:2021-01-15
-
记得勾选springconfig.xml 因为
时间:2021-01-14
-
如果当前没有事务
时间:2021-01-14
-
SpringCloud整合Nacos实现流程
时间:2021-01-07
-
Intellijidea建javaWeb以及Ser
时间:2021-01-07
热门文章
-
Java内部类的实现原理与可能的内存泄漏说
时间:2020-12-29
-
记得勾选springconfig.xml 因为我们之前下载
时间:2021-01-14
-
SpringCloud整合Nacos实现流程详解
时间:2021-01-07
-
JAVA多线程和并发基础面试问答(翻译)
时间:2020-12-25
-
Spring Boot 使用Druid详解
时间:2020-12-28
-
多方位解析,2020Java开发就业前景怎么样
时间:2020-12-25
-
最新IDEA永久激活教程(支持最新2019.2版本
时间:2020-12-25
-
Fitness fitness){ /*double X1=min+0.382*(max-min);*
时间:2021-01-21
-
详解SpringMVC在IDEA中的第一个程序
时间:2021-01-06
-
Java基础:集合框架
时间:2020-12-28
