1
driver.getContextHandles() - > [NATIVE_APP]

capabilities.setCapability("noReset", true);

1)Added wait time. Manually logged in to the account.

System.out.println(driver.getPageSource()); - prints the page source

Attaching success logs:-

[AndroidDriver] Found webviews: []
[AndroidDriver] Available contexts: ["NATIVE_APP"]
[W3C (afefcb31)] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
[HTTP] <-- GET /wd/hub/session/afefcb31-9574-4bf8-ba8a-fce9eb1e81a0/contexts 200 50 ms - 24
[HTTP] 
[HTTP] --> GET /wd/hub/session/afefcb31-9574-4bf8-ba8a-fce9eb1e81a0/source
[HTTP] {}
[W3C (afefcb31)] Calling AppiumDriver.getPageSource() with args: ["afefcb31-9574-4bf8-ba8a-fce9eb1e81a0"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"source","params":{}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"source","params":{}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: source
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Stream still not complete, waiting up to 60000ms for the data to arrive
[AndroidBootstrap] [UIAUTO STDOUT] [APPIUM-UIAUTO] [debug] Returning result: {"status":0,"value":"<\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout>
[AndroidBootstrap] [UIAUTO STDOUT] " bounds=\"[0,280][1440,2196]\" resource-id=\"\" instance=\"4\"><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.TableRow><\/android.widget.TableLayout>
[AndroidBootstrap] [UIAUTO STDOUT] false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\" scrollable=\"false\" long-clickable=\"false\" password=\"false\" selected=\"false\" bounds=\"[0,471][1440,1237]\" resource-id=\"com.adaptavant.setmore:id\/compactcalendar_view\" instance=\"1\"\/><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.LinearLayout>
[AndroidBootstrap] [UIAUTO STDOUT] ant.setmore:id\/add_appointmenttv\" instance=\"14\"\/><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout>
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Stream still not complete, waiting up to 60000ms for the data to arrive
[AndroidBootstrap] [UIAUTO STDOUT] droid.widget.LinearLayout\" package=\"com.adaptavant.setmore\" content-desc=\"\" checkable=\"false\" checked=\"false\" clickable=\"false\" enabled=\"true\" focusable=\"false\" focused=\"false\" scrollable=\"false\" long-clickable=\"false\" password=\"false\" selected=\"false\" bounds=\"[0,1584][1440,1769]\" resource-id=\"com.adaptavant.setmore:id\/noappt\" instance=\"14\"><\/android.widget.LinearLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.support.v7.widget.RecyclerView><\/android.view.ViewGroup><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.FrameLayout><\/android.widget.RelativeLayout><\/android.widget.FrameLayout><\/android.widget.RelativeLayout><\/android.widget.FrameLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.FrameLayout>
[AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] Stream still not complete, waiting up to 60000ms for the data to arrive
[AndroidBootstrap] [UIAUTO STDOUT] se\" focused=\"false\" scrollable=\"false\" long-clickable=\"false\" password=\"false\" selected=\"false\" bounds=\"[0,2196][288,2392]\" resource-id=\"\" instance=\"17\"><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.RelativeLayout><\/android.widget.LinearLayout><\/android.widget.LinearLayout><\/android.view.ViewGroup><\/android.widget.FrameLayout><\/android.widget.LinearLayout><\/android.widget.FrameLayout><\/android.widget.LinearLayout><\/android.widget.FrameLayout><\/hierarchy>"}[/APPIUM-UIAUTO]
[AndroidBootstrap] Received command result from bootstrap
[W3C (afefcb31)] Responding to client with driver.getPageSource() result: "
[HTTP] <-- GET /wd/hub/session/afefcb31-9574-4bf8-ba8a-fce9eb1e81a0/source 200 216 ms - 48361

2) Logged in to the account(automation script), and try to print

System.out.println(driver.getPageSource()); - Appium is not responding. 

Unable to identify elements inside the app.

Attaching the failure logs:-

[AndroidDriver] Found webviews: []
[AndroidDriver] Available contexts: ["NATIVE_APP"]
[W3C (3d562d17)] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
[HTTP] <-- GET /wd/hub/session/3d562d17-697c-4bca-b4eb-c5d0dcd898d6/contexts 200 164 ms - 24
[HTTP] 
[HTTP] --> GET /wd/hub/session/3d562d17-697c-4bca-b4eb-c5d0dcd898d6/source
[HTTP] {}
[W3C (3d562d17)] Calling AppiumDriver.getPageSource() with args: ["3d562d17-697c-4bca-b4eb-c5d0dcd898d6"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"source","params":{}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"source","params":{}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: source
[HTTP] <-- GET /wd/hub/session/3d562d17-697c-4bca-b4eb-c5d0dcd898d6/source - - ms - -
[HTTP] 
[HTTP] --> GET /wd/hub/session/3d562d17-697c-4bca-b4eb-c5d0dcd898d6/source
[HTTP] {}
[W3C (3d562d17)] Calling AppiumDriver.getPageSource() with args: ["3d562d17-697c-4bca-b4eb-c5d0dcd898d6"]
1
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, 'uiAutomator2');

Added the capability and it works now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.