Selenium中定位方式记录
来源:互联网 发布:青牛软件 上市 编辑:程序博客网 时间:2024/05/16 12:28
在这里仅记录一下常用的定位方式:
- 1. id定位
@FindBy(id = "EmailInvoice")private WebElement emailInvoiceCheckBox;
- 2. name/class等标签定位
@FindBys(@FindBy(className = "Content"))private List<WebElement> resolutionText;
- 3. css定位
//一级一级查找# // . //:nth-child@FindBy(css = "#InvoiceInfoBlock .invoiceInfoRow:nth-child(2)")private WebElement invoiceNumber;//使用部分属性值匹配@FindBy(css = "img[title*='4.00']")private WebElement surveryRatingImg;
- 4. xpath定位
//通过绝对路径做定位By.xpath("html/body/div/form/input")//通过相对路径定位By.xpath("//input")//通过元素索引定位By.xpath("//input[4]")//使用xpath属性定位By.xpath("//input[@id='kw1']")By.xpath("//input[@type='name' and @name='kw1']")//使用部分属性值匹配By.xpath("//input[start-with(@id,'valueA'")By.xpath("//input[ends-with(@id,'valueB'")By.xpath("//input[contains(@id,'valueC')]")/**包含noteDescription的span的父亲节点的第一个兄弟节点下的第一个div下的第五个a.其中1. /.. / 从根节点选取 .. 选取当前节点的父节点2. following-sibling 选取当前节点后的同级节点 preceding-sibling 选取当前节点前的同级节点*/By.xpath("//span[contains(text(),'" + noteDescription + "') and @id = 'noteText']/../following-sibling::div[1]/a[5]")
0 0
- Selenium中定位方式记录
- selenium java的八中定位方式
- Selenium元素定位方式
- selenium webdriver定位方式
- selenium CSS定位方式
- Selenium中无法定位的元素的原因探讨记录
- Selenium提供的定位方式
- python selenium xpath定位方式
- Selenium Webdriver元素定位的方式
- Selenium+Webdriver 常用的元素定位方式
- Selenium Webdriver元素定位的方式
- selenium python中关于iframe的定位
- selenium定位frameSet中得frame
- Selenium中CSS定位Web UI元素
- selenium python中关于iframe的定位
- selenium中如何定位伪元素
- Selenium Webdriver元素定位的八种常用方式
- Selenium Webdriver元素定位的八种常用方式
- 苹果进入多事之秋,电池门禁售门病魔缠身
- Xcode8 关闭不相关的log
- centOS6.5下安装node.js
- 23. Merge k Sorted Lists 典型的分治,另,合并两个List的好写法
- Android系统运动传感器
- Selenium中定位方式记录
- LeetCode 422. Valid Word Square 验证单词平方
- 动态SQL片段
- 2017年系统分析师架构师备考之路(一)
- 这是一份创业的感想,但也敲醒了很多人
- javascript Date format(js日期格式化)
- Spinner同一Item事件响应+默认第一次不触发事件
- 出现 java.lang.NoClassDefFoundError: 在Android 5.0以下
- Redis-cli 命令