Appium定位元素方式

XPATH定位

from selenium.webdriver.common.by import By
def login(driver):
      el4=driver.find_element(By.XPATH,'//xpath of login')
      el4.click()
      el4.clear()

 

ACCESSIBILITY_ID
el11 = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='我的\n第 2 个标签,共 2 个')

ANDROID_UIAUTOMATOR
e2 = driver.find_element(by=AppiumBy.ANDROID_UIAUTOMATOR, value='new UiSelector().description("注销账号")')

el3=driver.find_element(by=AppiumBy.ANDROID_UIAUTOMATOR, value='new UiSelector().text("CONFIRM")')


优先使用ANDROID_UIAUTOMATOR方式,因为速度最快


posted @ 2025-07-04 15:20  金一九  阅读(7)  评论(0)    收藏  举报