Nine, Appium-python-UI automation of positioning by text

 

 

 

1. By locating text xpath

xpath path: //android.widget.EditText [@ text = ' Please enter your full address contains the street ' ]

2. AndroidUIAutomator

# This at run time, calling the Android native UI framework UiAutomator of Api 
# introduce a few simple common, text, className, Resource-the above mentioned id 
# text 
# matches all text text 
driver.find_element_by_android_uiautomator ( ' new new UiSelector (). text ( "Please enter a full address of the street") ' )
 # include text text 
driver.find_element_by_android_uiautomator ( ' new new UiSelector (). textContains ( "complete street address") ' )
 # in a text What started 
driver.find_element_by_android_uiautomator ( ' new new UiSelector (). textStartsWith ( "please") ' )
 # regular matching text 
driver.find_element_by_android_uiautomator ( 'new UiSelector (). textMatches ( " ^ complete street address. *") ' )
 
# className
driver.find_elements_by_android_uiautomator('new UiSelector().className("android.widget.EditText")') 

# classNameMatches
driver.find_elements_by_android_uiautomator('new UiSelector().classNameMatches("^android.widget.*")')

# resource-id、resourceIdMatches 类似我们html id 这个可能重复,
driver.find_element_by_android_uiautomator('new UiSelector().resourceId("com.syqy.wecash:id/et_content")')

 





Guess you like

Origin www.cnblogs.com/chushujin/p/12377132.html