【Selenium】6操作控件
来源:互联网 发布:徐静蕾字体字帖淘宝 编辑:程序博客网 时间:2024/06/14 07:12
①输入框:
WebElement input= driver.findElement(By.linkText(""));
input.clean;清除input.sendKeys("");输入指定内容
②单选下拉框:
Select select=new Select(driver.findElement(By.xpath("")));//是否可以多选,返回falseAssert.assertFalse(select.isMultiple());//选中的列表选项select.selectByIndex(3);select.selectByValue("shanzha");select.selectByVisibleText("山楂");//列表选中文本select.getFirstSelectedOption().getText();
//selectList.getOptions()下拉框所有选项for (WebElement option:selectList.getOptions()){ list.add(option.getText()); Assert.assertEquals(stringList.toArray(),list.toArray());}
③多选下拉框:
//选中的所有列表选项select.deselectAll;
//取消列表选项
select.deselectByIndex(3);select.deselectByValue("shanzha");select.deselectByVisibleText("山楂");
④单选框
WebElement select=driver.findElement(By.xpath("")); if (!select.isSelected()){ select.click(); //判断选中 Assert.assertTrue(select.isSelected()); }}
⑤复选框:选中再click,处于非选中状态
⑥拖拽元素
WebElement element = driver.findElement(By.xpath(""));//向下拖是个像素,共拖动5次for (int i = 0; i <5 ; i++) { new Actions(driver).dragAndDropBy(element,0,10).build().perform();}//向右拖是个像素,共拖动5次for (int i = 0; i <5 ; i++) { new Actions(driver).dragAndDropBy(element,10,0).build().perform();}
阅读全文
0 0
- 【Selenium】6操作控件
- selenium 操作日期控件
- Selenium webdriver操作日历控件
- Selenium webdriver操作日历控件
- selenium常用控件的操作
- Selenium webdriver 操作日历控件
- selenium之操作日期控件
- selenium操作日历控件(java版本)
- selenium处理上传控件、不能操作的windows控件
- Selenium webdriver 学习笔记(三) - 基本UI控件操作
- Selenium webdriver 学习笔记(三) - 基本UI控件操作
- Selenium+Python 测试对象(控件)的登录操作
- Selenium学习笔记19-操作控件设置高亮
- Web自动化测试(4): Selenium Web Driver 操作控件完成页面自动化测试的例子。
- selenium+python关于操作日历控件实现向日历文本框传递值的方法
- 22、Selenium + Python 实现 UI 自动化测试-操作日期时间控件
- Selenium操作联动菜单
- phpunit selenium 操作html
- javascript 原生js修改浏览器复制、粘贴内容
- 友元类实现数组排序
- kubernetes资源对象--DaemonSet
- Shiro集成CAS登录成功跳转地址问题
- android实现图片圆角和圆形
- 【Selenium】6操作控件
- 【轻松同传】-有TA,走遍全球都不怕!
- SQL
- codeforces 426 Div2C 833A The Meaningless Game(二分||数学)
- java操作时间,将当前时间减一年,减一天,减一个月
- 带你走进多线程的世界(多线程实现方式)
- 开启mysql慢查询日志
- 网络号、主机号、子网号、子网掩码、子网划分
- Linux-进程控制