selenium 元素定位

上一篇 / 下一篇  2017-02-09 10:47:37 / 个人分类:web测试

1. name
通过 name 属性

2. id 
通过id 属性

3. 通过 xpath

4. 通过 link_text
例如: <a href="continue.html">Continue</a>
continue_link = driver.find_element_by_link_text('Continue')
continue_link = driver.find_element_by_partial_link_text('Conti')

5. 通过 tag_name
例如: <h1>Welcome</h1>
heading1 = driver.find_element_by_tag_name('h1')

6. 通过class_name 

7. 通过css 
CSS 知识:http://saucelabs.com/resources/articles/selenium-tips-css-selectors

8

TAG: 元素

 

评分:0

我来说两句

srialy

srialy

走走停停,删删剪剪,指尖的跳动总是来不及,如此纠结的青春

日历

« 2024-04-29  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 18311
  • 日志数: 20
  • 建立时间: 2010-07-02
  • 更新时间: 2017-02-21

RSS订阅

Open Toolbar