系列介绍

QAUi 系列阅读指南

Appium Desktop 版查看控件

{
  "deviceName": "396f68f07d94",
  "automationName": "uiautomator2",
  "platformName": "Android",
  "noReset": true,
  "autoLaunch": false,
  "appPackage": "xxx.x.x.xx",
  "appActivity": "x.x.x.x.Activity",
  "unicodeKeyboard": false,
  "resetKeyboard": true,
  "noSign": true,
  "platformVersion": "7.1.2"
}
{
  "deviceName": "iphone8plus",
  "platformVersion": "11.2.5",
  "udid": "c65d00a8cda9947953dac52e92071aa1481f23a2",
  "automationName": "XCUITest",
  "noReset": false,
  "platformName": "iOS",
  "bundleId": "xx.xxx.xx.x",
  "autoLaunch": false
}

android 控件体系

//唯一标识
Find By Selector
id  com.benqu.wuta:id/home_camera_view
xpath   /hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ImageView
//属性
Attribute   Value
NAF true
index   0
text    相机
class   android.widget.ImageView
package com.benqu.wuta
content-desc    进入相机
checkable   false
checked false
clickable   true
enabled true
focusable   false
focused false
scrollable  false
long-clickable  false
password    false
selected    false
bounds  [245,1071][475,1301]
resource-id com.benqu.wuta:id/home_camera_view
instance    8

resource-id

WebElement webElement=driver.findElementById("com.benqu.wuta:id/home_camera_view");

text (UIAutomator1 查找体系)

WebElement webElement=driver.findElementByAndroidUIAutomator("new UiSelector().text(\"相机\")");

content-desc

WebElement webElement=driver.findElementByAccessibilityId("进入相机");

class

WebElement webElement=driver.findElementByClassName("android.widget.ImageView");

XPath

WebElement webElement=driver.findElementByXPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ImageView");

iOS 控件体系

Find By Selector
accessibility id    企业微信
xpath   //XCUIElementTypeIcon[@name="企业微信"]

Attribute   Value
type    XCUIElementTypeIcon
name    企业微信
label   企业微信
enabled true
visible true
x   199
y   378
width   64
height  86

name

WebElement webElement=driver.findElementByAccessibilityId("企业微信");

xpath

WebElement webElement=driver.findElementByXPath("//XCUIElementTypeIcon[@name=/"企业微信/"]");

NsPredicate (ios xcuitest-driver 查找体系)


↙↙↙阅读原文可查看相关链接,并与作者交流