Naveen Chhaniwal
Naveen Chhaniwal

Reputation: 704

Could not change profile image of my Android app while automating with Appium

Enter image description here

I could not select an image from the gallery app. I am automating my Android app using Appium.

Upvotes: 2

Views: 759

Answers (2)

priyanka p
priyanka p

Reputation: 128

  1. I have launch Android photo gallery using following code from a activity.

    Intent intent =  new Intent(Intent.ACTION_PICK);
    intent.setType("image/*");
    startActivity(intent);
    
  2. Test code can have following implementation.

    WebDriverWait wait = new WebDriverWait(driver, 30);wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("com.android.gallery:id/grid")));
     driver.context("NATIVE_APP");
     HashMap<String, Double> map = new HashMap<String, Double>();
     map.put("x", 0.3);
     map.put("y", 0.3);
     (driver).executeScript("mobile: tap", map);
    

Upvotes: 1

priyanka p
priyanka p

Reputation: 128

how are you implementing it? You can use UIAutomator to find out the xPATH or IDs to reach to the image. you can also use "tap" to select a particular image. post your existing code,

Upvotes: 1

Related Questions