getText() takes too long (10 sec)

Hi,

I tried to getText() of an element in a specific screen in my app (with a GL rendering), and it takes 10 seconds to get the element’s text .
and when the GL rendering is paused it takes 20ms to get the element’s text.

Do you have any explanation for this ?
Is there something I can do ? (I really need to get the element’s text much quicker)

Thanks !!!

Code
t =self.driver.find_element_by_id(“com.App:id/debugTextView”).text

appium server logs

[HTTP] --> GET /wd/hub/session/7cade58b-3bac-4096-a4be-8fdb94a317ab/element/27/text
[HTTP] {}
[W3C] Calling AppiumDriver.getText() with args: [“27”,“7cade58b-3bac-4096-a4be-8fdb94a317ab”]
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“element:getText”,“params”:{“elementId”:“27”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getText”,“params”:{“elementId”:“27”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“T2T Time: 136ms”}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getText() result: “T2T Time: 136ms”
[HTTP] <-- GET /wd/hub/session/7cade58b-3bac-4096-a4be-8fdb94a317ab/element/27/text 200 10104 ms - 89

1 Like

@Amit_Mia it’s only taking 136 ms

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“T2T Time: 136ms”}
[AndroidBootstrap] Received command result from bootstrap

You have setup longer implicit wait or using both implicit & explicit waits together. Which gives weired results.

You need to follow same good practices from web automation to mobile as well, don’t mix implicit and explicit waits, keep implicit wait to minimal and use custom explicit wait for individual elements.

Hope it helps.

Regards,
Vikram

No it takes 10104 ms (10 sec)

  • GET /wd/hub/session/7cade58b-3bac-4096-a4be-8fdb94a317ab/element/27/text 200 10104 ms

there are no waits in my code

136 ms is the text I am getting from the element ( T2T Time: 136ms )

Refer this and add this capability in your script.
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, “uiAutomator2”);

I am using uiautomator2 and I am experiencing the same issue.

The appium response takes about 10 seconds when a webview is playing a video in the application under test, android. But for the rest, it takes less than 100 ms.

Versions:
Appium-Python-Client==3.0.0
decorator==5.0.9
docutils==0.17.1
kitchen==1.2.6
robot==20071211
robotframework==6.1
robotframework-appiumlibrary==2.0.0
robotframework-lint==1.1
robotframework-pythonlibcore==4.2.0
robotframework-seleniumlibrary==6.1.1
selenium==4.12.0
six==1.16.0
urllib3==1.26.5

Appium Server 2.1.3

I found this issue report:

which lead me to a specific setting and the issue is fixed.
driver.setSetting(Setting.WAIT_FOR_IDLE_TIMEOUT, 500);