Appium+Python 自动化-appium常用元素定位方法
来源:互联网 发布:通货膨胀率 知乎 编辑:程序博客网 时间:2024/06/05 06:56
ID定位
# resourceId属性的方法
driver.find_element_by_id('com.lizi.app:id/setting_imageView').click()
#以accessibility_id进行定位,对Android而言,就是content-description属性
driver.find_element_by_accessibility_id('push_button').click()
ClassName 定位
# 定位唯一元素
self.driver.find_element_by_class_name("android.widget.EditText")
# 找到所有android.widget.EditText并定位第一个
self.driver.find_elements_by_class_name("android.widget.EditText")[0]
Name 定位
#根据name进行定位,对于android来说,就是text属性
driver.find_element_by_name(u"登 录").click()
Uiautomator 定位
text属性的方法
driver.find_element_by_android_uiautomator('new UiSelector().text("Custom View")').click() #textdriver.find_element_by_android_uiautomator('new UiSelector().textContains("View")').click() #textContainsdriver.find_element_by_android_uiautomator('new UiSelector().textStartsWith("Custom")').click() #textStartsWithdriver.find_element_by_android_uiautomator('new UiSelector().textMatches("^Custom.*")').click() #textMatches
- class属性的方法
#className
driver.find_element_by_android_uiautomator('new UiSelector().className("android.widget.TextView").text("Custom View")').click()
#classNameMatchesdriver.find_element_by_android_uiautomator('new UiSelector().classNameMatches(".*TextView$").text("Custom View")').click()
- resourceId属性的方法
#resourceId
driver.find_element_by_android_uiautomator('new UiSelector().resourceId("android:id/text1")')
#resourceIdMatches
driver.find_element_by_android_uiautomator('new UiSelector().resourceIdMatches(".*id/text1$")')
- 元素的其他属性
driver.find_element_by_android_uiautomator('new UiSelector().clickable(true).text("Custom View")').click()
阅读全文
0 0
- Appium+Python 自动化-appium常用元素定位方法
- Appium自动化元素定位
- python+appium重写元素定位的方法
- Appium+python自动化学习(二)——定位元素
- Appium 元素定位方法(Java版)
- Appium Android 元素定位方法 原生+H5
- Appium Android 元素定位方法 原生+H5
- Appium for Android元素定位方法
- Appium 元素定位
- appium定位元素
- appium元素定位问题
- Appium元素定位汇总
- appium关于定位元素
- appium+python自动化测试
- Appium python 自动化
- appium 自动化脚本 启动虚拟器&定位元素
- Appium的定位方法
- appium 获取元素方法
- netty入门学习
- 网络访问协议
- jquery实现图片上传前本地预览功能
- Linux yum 下载rpm包而不进行安装
- 线段树入门(一)
- Appium+Python 自动化-appium常用元素定位方法
- RecyclerView滚动事件分析
- rados swift copy格式
- phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。
- node.js 教你写爬虫(附上gbk,gb2312中文乱码的解决方法)
- CSU-ACM2017暑假集训2-二分搜索 hdu2119
- 部落冲突
- 数理逻辑2 -- 量化理论3
- 为什么大多数人不能够成为架构师