iOS自动化测试过程中,经常遇到无法通过d、name或者xpath定位元素的问题,那么该如何解决这个问题呢?

使用以下两种方式均可:

1、TouchAction(self.driver).press(x=0, y=466).release().perform()
    使用该方法时需要导入TouchAction()方法,即:
    from appium.webdriver.common.touch_action import TouchAction
    那么坐标是如何获取的呢?
    开启appium,连接到app,然后点击具体元素可以显示某个元素的具体坐标x,y,如下图:
   iOS+python+appium自动化测试当通过id、name或者xpath无法定位元素时解决方案
 
2、self.driver.tap([(249,466)],500)
     使用self.driver.tap([(249,466)],500)为什么有时候还是定位不到元素呢?解决方案如下:
     在self.driver.tap([(249,466)],500)前面加上休眠时间,即:
     time.sleep(1)
     self.driver.tap([(249,466)],500)
     如何获取坐标呢?
     同1中的方法
 
注:完整代码参考:https://www.cnblogs.com/lxmtx/p/12499303.html

 

相关文章:

  • 2021-12-18
  • 2021-06-24
  • 2022-01-07
  • 2022-02-20
  • 2022-12-23
猜你喜欢
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-09-02
  • 2021-10-14
相关资源
相似解决方案