appium元素定位总结
appium元素定位方法总结
使用uiautomatorviewer定位工具driver.find_element_by_android_uiautomator(uia_string)
根据resourceId属性定位
driver.find_element_by_android_uiautomator('new UiSelector().resourceId("%s")')
体现:如下图,点击顶部扫码器:
对应uiautomator名称:“ resource-id”:
driver.find_element_by_android_uiautomator('new UiSelector().resourceId("com.rfchina.app.supercommunity:id/square_title_btn_scan")').click()
选择resource-id定位需要特别注意,界面中resource-id不是唯一的,有可能存在很多控件的resource-id是相同的。
根据文本,描述,类名,索引属性定位
# 根据 text 定位
driver.find_element_by_android_uiautomator('new UiSelector().text("%s")') #对应uiautomator名称:“text”
# 根据 description 定位
driver.find_element_by_android_uiautomator('new UiSelector().description("%s")') # 对应uiautomator名称:“content-desc”
# 根据 className 定位
driver.find_element_by_android_uiautomator('new UiSelector().className("%s")') # 对应uiautomator名称:“class”
# 根据 index 定位
driver.find_element_by_android_uiautomator('new UiSelector().index("%s")') # 对应uiautomator名称:“index”
选择className定位需要特别注意,界面中class往往都不是唯一的,大量控件的class会一样。
根据content-desc定位 driver.find_element_by_accessibility_id()
根据xpath定位 driver.find_element_by_xpath()
from appium import webdriver
import time desired_caps = {
"appPackage": "com.rfchina.app.supercommunity",
"appActivity": "com.rfchina.app.supercommunity.client.StartActivity",
"platformName": "Android",
"deviceName": "Android Emulator"
} driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(5)
driver.find_element_by_id("com.rfchina.app.supercommunity:id/img_serivce_communities_layout").click()
appium元素定位总结的更多相关文章
- Python Appium 元素定位方法简单介绍
Python Appium 元素定位 常用的八种定位方法(与selenium通用) # id定位 driver.find_element_by_id() # name定位 driver.find_ ...
- 4、通过uiautomatorviewer实现appium元素定位
熟悉selenium自动化的小伙伴应该知道WebDriver 提供了八种元素定位方法: idnameclass nametag namelink textpartial link textxpathc ...
- appium元素定位工具
appium元素定位工具介绍 使用uiautomatorviewer定位工具 使用Appium Inspector定位工具 使用uiautomatorviewer定位工具 谷歌在Android S ...
- APP 自动化之appium元素定位(三)
APP自动化测试关键环节--元素定位,以下我们来了解appium提供的元素定位方法! 1. id定位,id一个控件的唯一标识,由开发人员在项目中指定,如果一个元素有对应的resource-id,我们就 ...
- appium 元素定位方法汇总
以上图为例,要定位到右下角的 我的 ,并点击 # appium的webdriver提供了11种元素定位方法,在selenium的基础上扩展了三个,可以在pycharm里面输入driver.find_e ...
- appium 元素定位工具
两种元素定位工具: 1.uiautomatorviewer是android-sdk自带的一个元素定位工具,目录D:\androidsdk\androidsdk\tools\bin . 双击启动uiau ...
- appium 元素定位与操作:
一.常用识别元素的工具 uiautomator:Android SDK自带的一个工具,在tools目录下 monitor:Android SDK自带的一个工具,在tools目录下 Appium I ...
- appium===元素定位
一.常用识别元素的工具 uiautomator:Android SDK自带的一个工具,在tools目录下 monitor:Android SDK自带的一个工具,在tools目录下 Appium Ins ...
- Appium——元素定位
首先介绍两种定位元素的工具,appium自带的 Inspector 和 android SDK自带的 uiautomatorviewer 1.UIAutomator Viewer比较简单,在模拟器打开 ...
随机推荐
- lua table面向对象扩展
一 .table扩展 -- 返回table大小 table.size = function(t) local count = 0 for _ in pairs(t) do count = count ...
- Spring Boot 加载application.properties顺序
1.准备四份application.properties a.项目根目录下config/application.properties ,内容为: test.user.name = a b.项目根目录 ...
- LoRa联盟的简介
LoRa联盟成立于2015年3月,从成立开始,LoRaWAN规范就在不断更新,从1.0.0版本已更新至1.0.2版本,目前能公开下载的事2016年7月完成的1.0.2版本,可以看到该规范的主要作者包括 ...
- php 计算2点之间的距离
//获取该点周围的4个点 $distance = 1;//范围(单位千米) $lat = 113.873643; $lng = 22.573969; define('EARTH_RADIUS', 63 ...
- Vue+Antd搭配百度地图实现搜索定位等功能
前言 最近,在做vue项目的时候有做到选择地址功能,而原项目中又引入了百度地图,所以我就打算通过使用百度地图来实现地址搜索功能啦. 本次教程可能过于啰嗦,所以这里先放上预览地址供大家预览--点我预览, ...
- [Luogu P3953] 逛公园 (最短路+拓扑排序+DP)
题面 传送门:https://www.luogu.org/problemnew/show/P3953 Solution 这是一道神题 首先,我们不妨想一下K=0,即求最短路方案数的部分分. 我们很容易 ...
- 适合 C++ 新手学习的开源项目——在 GitHub 学编程
作者:HelloGitHub-小鱼干 俗话说:万事开头难,学习编程也是一样.在 HelloGitHub 的群里,经常遇到有小伙伴询问编程语言如何入门方面的问题,如: 我要学习某一门编程语言,有什么开源 ...
- Docker 基础 B站 学习 最强 教程
狂神说!! https://www.bilibili.com/video/BV1og4y1q7M4
- mac os 10.15安装jdk 1.6
1.如果出现报错 已经安装了最高版本 下载请看:https://www.jianshu.com/p/3b580c405c7c 请看下面方法处理错误 1.在mac的访达中 找到 "脚本编辑器& ...
- Docker学习笔记:Alpine镜像+Python3安装+http服务器
编写Dockerfile文件使用最新的Alpine镜像并安装Python3环境,如下: 因为python高于3.4则不会默认安装pip,需要手动安装. 试了很多其他办法都没安装上,唯有下载get-pi ...