Appium(Android) & Ruby 在叠加层上查找元素很慢
Appium(Android) & Ruby slow to find element on an overlay
我目前正在 运行 使用 Appium 和 ruby 在 Android 上进行一些自动化测试,但是测试中的一个步骤非常慢。发生的事情是 appium 单击主屏幕顶部的菜单按钮。在此之后,它会在菜单上寻找一个按钮。在这一点上,它变得非常缓慢。我无法按文本搜索,因为主屏幕上的文本与按钮上的文本完全匹配,我无法更改它。因此,我正在按 content-desc 进行搜索,但这似乎要花很长时间。
有什么办法可以加快速度吗?有什么方法可以让 appium 只查看覆盖层而忽略覆盖层后面的内容吗?
这里是appium日志耗时较长的例子。
[HTTP] --> POST /wd/hub/session/9d9d5814-2085-4f25-bb5e-e4cc0838fa25/elements {"using":"id","value":"Performances button"}
[MJSONWP] Calling AppiumDriver.findElements() with args: ["id","Performances button"...
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Performances button","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Performances button","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'Performances button' using 'ID' with the contextId: '' multiple: true
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[DESCRIPTION=Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[DESCRIPTION=Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[DESCRIPTION=Performances button, INSTANCE=0]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (1)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[DESCRIPTION=Performances button, INSTANCE=1]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"11"}]}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"11"}]
[HTTP] <-- POST /wd/hub/session/9d9d5814-2085-4f25-bb5e-e4cc0838fa25/elements 200 80730 ms - 90
只是想我会更新这个。发现速度缓慢是由动画引起的,所以我只是在 phone 上关闭了它们,这大大加快了测试速度。
结帐 ui automation jsonrpc server which is uiautomator wrapper。如果您使用 wifi 网络在设备 jsonrpc 服务器中访问它,则没有速度限制!
我目前正在 运行 使用 Appium 和 ruby 在 Android 上进行一些自动化测试,但是测试中的一个步骤非常慢。发生的事情是 appium 单击主屏幕顶部的菜单按钮。在此之后,它会在菜单上寻找一个按钮。在这一点上,它变得非常缓慢。我无法按文本搜索,因为主屏幕上的文本与按钮上的文本完全匹配,我无法更改它。因此,我正在按 content-desc 进行搜索,但这似乎要花很长时间。
有什么办法可以加快速度吗?有什么方法可以让 appium 只查看覆盖层而忽略覆盖层后面的内容吗?
这里是appium日志耗时较长的例子。
[HTTP] --> POST /wd/hub/session/9d9d5814-2085-4f25-bb5e-e4cc0838fa25/elements {"using":"id","value":"Performances button"}
[MJSONWP] Calling AppiumDriver.findElements() with args: ["id","Performances button"...
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Performances button","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Performances button","context":"","multiple":true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding 'Performances button' using 'ID' with the contextId: '' multiple: true
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=uk.co.bbc.music:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[DESCRIPTION=Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[DESCRIPTION=Performances button]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[DESCRIPTION=Performances button, INSTANCE=0]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element[] is null: (1)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[DESCRIPTION=Performances button, INSTANCE=1]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":[{"ELEMENT":"11"}]}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.findElements() result: [{"ELEMENT":"11"}]
[HTTP] <-- POST /wd/hub/session/9d9d5814-2085-4f25-bb5e-e4cc0838fa25/elements 200 80730 ms - 90
只是想我会更新这个。发现速度缓慢是由动画引起的,所以我只是在 phone 上关闭了它们,这大大加快了测试速度。
结帐 ui automation jsonrpc server which is uiautomator wrapper。如果您使用 wifi 网络在设备 jsonrpc 服务器中访问它,则没有速度限制!