appium-python-元素定位

时间:2020-07-26 00:10:47   收藏:0   阅读:99

appium继承了selenium的所有元素定位方式(web端),并有自己的元素定位方式

技术图片

 

 

 

# id
driver.find_element_by_id("cn.TuHu.android:id/productslist_text")


# class
driver.find_element_by_class_name("android.widget.TextView")


# xpath
driver.find_element_by_xpath("//android.widget.TextView[@text=‘空调养护‘]")
driver.find_element_by_xpath("//android.widget.TextView[@recource-id=‘cn.TuHu.android:id/productslist_text‘

 

# uiautomator

# UiSelector()为java函数
loc = ‘new UiSelector().text("空调养护")‘
driver.find_element_by_android_uiautomator(loc)
# 组合定位
loc = ‘new UiSelector().text("空调养护").recource-id("cn.TuHu.android:id/productslist_text")‘
driver.find_element_by_android_uiautomator(loc)

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!