主题
uiautomator2
遍历元素
python
def check_product(self,ui_amount):
childCount = self.driver(resourceId="charge-selector-container").info['childCount']
for index in range(0, childCount * 4 + 1):
content = self.driver(resourceId="charge-selector-container").child_by_instance(index).get_text()
print("find product amount ",content)
if content == ui_amount:
status = self.driver(resourceId="charge-selector-container").child_by_instance(index + 1).get_text()
print("find product status ", status)
if status == '备货中':
return False
return True
return False
遍历上图的每个充值金额是否可充值