Unable to select gallery image using appium

I have been trying since long to click on the image from gallery but my driver just executes the code but nothing happens on the screen and than it fails while locating element on next page.

Following is the Image:

I have been trying since long to click on the image from gallery but my driver just executes the code but nothing happens on the screen and than it fails while locating element on next page.

Scenario is:

Note: I am automating Ionic App which takes you to Native screen.

  1. Select the first image
  2. And than OK button will be enabled
  3. Than click on OK button

Following is My code:

        app.tap("sell_add_photo");
        waitElement.until(ExpectedConditions.elementToBeClickable(By.xpath(field.get("sell_photo_choose_photo"))));
        app.tap("sell_photo_choose_photo");

        Thread.sleep(5000);
        Set<String> contextNames2 = driver.getContextHandles();
        for (String contextName : contextNames2) {
            if (contextName.contains("NATIVE")) {
                System.out.println(contextName);
                driver.context(contextName);
                Thread.sleep(5000);
            }
        }

        driver.findElement(By.xpath("//android.widget.GridView//android.widget.ImageView[1]")).click();
        driver.findElement(By.xpath("//android.widget.FrameLayout[2]//android.widget.TextView[1]")).click();

        waitElement.until(ExpectedConditions.elementToBeClickable(By.xpath(field.get("sell_image_listing"))));

In appium server it shows, It has clicked image and Okay button and start searching for next element. But in actually it does not click on any of the element on screen.

1 Like

Did you get answer? @Jeevan_Bhushetty