方法如下:
def is_element_exist(self, element):
    source = self.driver.page_source
    print(source)
    if element in source:
        return True
    else:
        return False

 

调用方法示例:

比如,我在设备和安全这个页面,有以下元素,那么我判断有没有跳转到这个页面,就可以通过判断页面上有没有包含“设备和安全”这几个字,调用方法如下:

if self.is_element_exist("设备和安全"):
    print("元素存在")
else:
    print("元素不存在。")

appium中判断某个元素是否存在

 

相关文章:

  • 2021-11-17
  • 2021-08-16
  • 2021-05-30
  • 2021-12-08
  • 2022-02-23
  • 2021-11-17
  • 2021-06-22
  • 2021-06-01
猜你喜欢
  • 2021-07-21
  • 2021-11-07
  • 2021-10-14
  • 2021-06-15
  • 2021-12-22
  • 2021-12-22
  • 2021-12-27
相关资源
相似解决方案