1、针对UI自动化测试,最基础的内容是:元素定位。只有定位到了元素后,才能对其进行相应的操作

2、那么我们常见的几种定位方式有哪些呢

  1. by id

  JS写法:document.getElementById("serviceCode");

  selenium写法:driver.find_element_by_id("serviceCode")

  2. by name 

  JS写法:document.getElementsByName("serviceCode")[0]

  selenium写法:driver.find_element_by_name("serviceCode")

  3. by Link、by partial_link、by Tag、by class不写  

3、说了这么多,似乎还没有写怎么查看页面元素:打开网页,按F12->Elements

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
  • 2022-01-12
  • 2022-12-23
  • 2021-09-16
猜你喜欢
  • 2021-09-04
  • 2021-10-04
  • 2021-12-04
  • 2022-01-10
  • 2021-12-31
  • 2021-09-23
  • 2022-12-23
相关资源
相似解决方案