Search code examples
androidappium-android

After Accepting a popup, Appium can’t find any element in the app


ENV:- Appium latest 1.6.4, Android 7.1.1

I have a problem with appium, I have test that logins on android native app login screen, closes whats new popup and press menu button on next activity. On this activity appium can not get any element. Also it can’t get page source. It tries to perform any action and suspends for infinite time until app or test will be closed. Before this moment all the actions performs fine. I can’t figure out. Is it some problem with my app? Feels like appium can’t see any stuff on activity.

Appium Logs:

[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“6”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“6”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: click
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:true}
[AndroidBootstrap] Received command result from bootstrap
[W3C] Responding to client with driver.click() result: true
[HTTP] <-- POST /wd/hub/session/d74e0285-8c9f-48b1-9b86-963572ea80a9/element/6/click 200 3166 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/d74e0285-8c9f-48b1-9b86-963572ea80a9/element
[HTTP] {“using”:“xpath”,“value”:"//android.widget.EditText[contains(@resource-id,‘com.myapp:id/messageEdit’)]"}
[W3C] Calling AppiumDriver.findElement() with args: [“xpath”,"//android.widget.EditText[contains(@resource-id,‘com.myapp:id/messageEdit’)]",“d74e0285-8c9f-48b1-9b86-963572ea80a9”]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 30000 ms for condition
[AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[contains(@resource-id,‘com.myapp:id/messageEdit’)]",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[contains(@resource-id,‘com.myapp:id/messageEdit’)]",“context”:"",“multiple”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘//android.widget.EditText[contains(@resource-id,‘com.myapp:id/messageEdit’)]’ using ‘XPATH’ with the contextId: ‘’ multiple: false

Solution

  • I have added below capabilities and my issue got resolved.

    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiAutomator2");