Unable to find element on particular page of Native App by Appium

Summary:Appium is unable to identify any element on particular page of My Mobile native app. I have used all the possible locators for different elements shown on that page with help of UI Automate Viewer.

Can any one please help in same, the below ways I have opted for finding the solutions but nothing has worked till now.
Please refer the attached files for the error and the required page screenshots.


Tried Ways:

  1. Used different locators (by id/xpath/contains/accessibility/UIAutomate).
    2.Verified that the page belongs to native app only with no Web View.
    3.applied different types of sufficient wait for the page.
    4.driver.get.pagesource not working for the page.

@swati_dave hi.

  1. apk file you start with appium also have same package name “com.gisteam.rjiomaps.projectresq” ?
  2. try to find your button by className. will it find any?
// wait screen to load (give sleep for some seconds for sure)
List<MobileElement> list = driver.findElements(MobileBy.className("android.widget.ImageButton"));
System.out.println(list.size());

Thank u for reply!!

I have tried with the shared list code by class name but list size is coming as null.PFA appium logs for the same.

Can u please suggest any other workaround.

Hardly we can suggest anything when simple commands fail.

I faced similar problem, The problem was resolved when I used automationName desired capability for session and set it to UiAutomator2. i,e automationName=“UiAutomator2”.

I have tried the same but it is also not working. Thanks

Hi Would like to share that I handled this issue by using touch action command as shown below. After using this the script is identifying all elements on the page.

Not sure what was the reason::))
int x2 = (int) (size_serchedpge.width * 0.50);
int y2 = (int) (size_serchedpge.height * 0.50);
TouchAction action2 = new TouchAction((MobileDriver) driver).longPress(PointOption.point(x2, y2)).waitAction(WaitOptions.waitOptions(Duration.ofSeconds(60))).perform();

Thanks for the help!!

@swati_dave make it more simple:

   protected boolean tapByCoordinates(MobileElement element) {
           return tapByCoordinates(element.getCenter().x, element.getCenter().y);
   }

   protected boolean tapByCoordinates(int x, int y) {
       boolean result = false;
       try {
           PointOption pointOption = new PointOption().withCoordinates(x, y);
           new TouchAction(driver).tap(pointOption).perform();
           result = true;
       } catch (Exception e) {
           // ignore
       }
       return result;
   }
1 Like

Thank you Aleksei for the code, but the issue is that my elements are not having any properties as seen by UI Automate Viewer,so need to click on center of screen.

Regards
Swati Dave