appium - appium ios测试在部分电脑上运行缓慢的可能原因
问题描述
我正在 ios 上运行 appium 测试,这些测试在某些机器上运行非常非常缓慢,但在另一台机器上运行得更快。两台机器的规格有些相似,但性能差异很大。例如,我尝试向 4 个文本字段发送文本。在更快的机器上,这是它的运行速度:
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[3]/XCUIElementTypeTextField"}
##### Time to get element: 0.6259970664978027 seconds
##### Time to send keys: 1.412217140197754 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[5]/XCUIElementTypeTextField"}
##### Time to get element: 0.8429489135742188 seconds
##### Time to send keys: 1.5375289916992188 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[7]/XCUIElementTypeTextField"}
##### Time to get element: 0.8602356910705566 seconds
##### Time to send keys: 2.2906301021575928 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[9]/XCUIElementTypeSecureTextField"}
##### Time to get element: 0.8182432651519775 seconds
##### Time to send keys: 1.605348825454712 seconds
^^^ Machine specs:
Macbook Pro (15-inch 2017)
Processor : 2.9 Ghz Quad-Core I7
Memory: 16 GB
Graphics : Radeon Pro 560 4GB
Intel HD Graphics 630 1536 MB
而且,在较慢的机器上,结果如下:
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[3]/XCUIElementTypeTextField"}
##### Time to get element: 3.373900890350342 seconds
##### Time to send keys: 5.192986011505127 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[5]/XCUIElementTypeTextField"}
##### Time to get element: 4.875856876373291 seconds
##### Time to send keys: 5.553454875946045 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[7]/XCUIElementTypeTextField"}
##### Time to get element: 4.758421897888184 seconds
##### Time to send keys: 5.982282876968384 seconds
##### Starting get element with locator {:xpath=>"//XCUIElementTypeOther[@name='main'][1]/XCUIElementTypeOther[9]/XCUIElementTypeSecureTextField"}
##### Time to get element: 4.933738946914673 seconds
##### Time to send keys: 5.845119953155518 seconds
^^^ Machine specs:
Macbook Pro (15-inch 2016)
Processor : 2.7 Ghz Quad-Core I7
Memory: 16 GB
Graphics : Intel HD Graphics 530 1536 MB
我知道我使用的是长 xpath 定位器,这对于这些元素是必要的。我遇到的问题是为什么两者之间存在显着的性能差异。额外的 Radeon 显卡可能是原因吗?我缺少的较慢机器上的 ios 模拟器上是否有设置?我知道这是一个开放式问题,但我已经研究了这个问题好几天没有结果。任何帮助,将不胜感激。
解决方案
由于您使用的是不同的计算机,我的脑海中没有几个问题......
- 您是否在两台计算机上使用相同的 Xcode 和模拟器?
- Appium呢?
理想情况下,使用几乎相同的计算机,您应该不会看到太大的差异。您能否分享 Xcode 和 Appium 版本。
推荐阅读
- sql - 用户定义的表类型的数据类型无效
- python - 为什么 tesseract 不能提取具有黑色背景的文本?
- julia - 如何将@time 的输出存储到变量中?
- repeat - 无障碍模式重复
- java - 如何在启动应用程序时禁用 Job Spring Batch 的自动运行
- android - 如何使用 Kotlin 从 Room 获取最后一个值?
- python - 如何使用python格式化excel文件?
- git - 此 SSH RSA 密钥是否正确输入?
- node.js - 如何访问 CASL 条件的嵌套属性
- typescript - 带有索引签名的对象的 for..in 循环出现错误“元素隐式具有'任何'类型,因为类型的表达式......”