【发布时间】:2021-02-02 11:56:56
【问题描述】:
我正在 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 模拟器是否有设置?我知道这是一个开放式问题,但我已经研究这个问题好几天没有结果。任何帮助将不胜感激。
【问题讨论】:
标签: appium appium-ios xcuitest