MCPcopy
hub / github.com/MonsterNone/tmall-miao / xpath_exists

Method xpath_exists

modules/device_adapter.py:77–87  ·  view source on GitHub ↗

XPath判断元素是否存在(兼容hmdriver2和uiautomator2) hmdriver2: d.xpath('xxx').exists() 是方法调用 uiautomator2: d.xpath('xxx').exists 是属性(bool值)

(self, xpath_str)

Source from the content-addressed store, hash-verified

75 return self._device.xpath(xpath_str)
76
77 def xpath_exists(self, xpath_str):
78 """
79 XPath判断元素是否存在(兼容hmdriver2和uiautomator2)
80
81 hmdriver2: d.xpath('xxx').exists() 是方法调用
82 uiautomator2: d.xpath('xxx').exists 是属性(bool值)
83 """
84 if self.device_type == 'hmdriver2':
85 return self._device.xpath(xpath_str).exists()
86 else:
87 return self._device.xpath(xpath_str).exists
88
89 def __call__(self, **kwargs):
90 """选择器定位,支持 text, resourceId, className 等"""

Callers 4

find_timeout_xpathFunction · 0.80
find_time_15_taskFunction · 0.80
find_time_15_search_taskFunction · 0.80
find_time_5_taskFunction · 0.80

Calls 1

xpathMethod · 0.80

Tested by

no test coverage detected