-
Generally use xpath for positioning. When xpath is not easy to use, we can use the following two dedicated and ios positioning methods:
driver.find_element_by_ios_predicate("type=='XCUIElementTypeSecureTextField' AND value=='password'")
or
driver.ios_class_chain ('/XCUIElementTypeButton[label == "nav back"
]') - When running a program and clicking a control, sometimes the click cannot be completed, such as:
driver.find_element_by_xpath().click()
We can use the coordinates of the page element to complete the positioning click, such as:
driver.tap([(961, 308)], 500) The
reason is because click cannot complete the click, use tap.
- Use Appium's automatic recording function to find the coordinates of the control;
from appium.webdriver.common.touch_action import TouchAction
TouchAction(self.driver).press(x=491, y=589).move_to(x=491, y=589).release().perform()