2020年12月30日 appium 执行速度优化

1. 目前已知的导致速度慢的原因:

  1. 使用xpath,在查找元素过程中尽量少用xpath
  2. 用SetValue代替SendKey 
  3. 尽量少的和appium通讯
  4. 使用driver.PageSouce先将页面缓存起来,找元素先去driver.PageSouce找
cssSelector             # Selenium 最强大的定位方法,比 xpath 速度快,但比 xpath 难上手
linkText                # 链接元素的全部显示文字
partialLinkText         # 链接元素的部分显示文字
name                    # 元素的 name 属性,目前官方在移动端去掉这个定位方式,使用 AccessibilityId 替代
tagName                 # 元素的标签名
className               # 元素的 class 属性
id                      # 元素的 id 属性
xpath                   # 比 css 定位方式稍弱一些的定位方法,但胜在容易上手,比较好使用,缺点就是速度慢一些。
AccessibilityId         # Appium 中用于替代 name 定位方式
AndroidUIAutomator      # Android 测试,最强大速度最快的定位方式
iOSNsPredicateString    # iOS 谓词的定位方式,仅支持 XCTest 框架,需大于 iOS 9.3或以上
IosUIAutomation         # iOS 谓词的定位方式,仅支持 UIAutomation 框架,需大于 iOS 9.3或以下
iOSClassChain           # 国外大神 Mykola Mokhnach 开发类似 xpath 的定位方式,仅支持  XCTest 框架,,不如 xpath 和 iOSNsPredicateString 好
windowsAutomation       # windows 应用自动化的定位方式

           

猜你喜欢

转载自blog.csdn.net/quwujin/article/details/111943744