appium ios测试在某些计算机上运行缓慢的可能原因

问题描述

我在ios上运行appium测试,这些ios在某些机器上运行非常非常慢,而在另一台机器上运行得更快。两种机器都有类似的规格,但性能差异很大。例如,我尝试向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版本。