Search code examples
seleniumappium

Google Sign In Appium , get list of all account


com.google.android.gms:id/account_picker

I have an google sign in button , which on click open picker to select account to sign into an app , .

How we can get list of all account email address shown and also how to select specific email address to sign in android app.


Solution

  • If some one is looking for getting list of all gmail id from google account picker,

    One can do using following code.

    List<WebElement> acc_picker= driver.findElements(By.xpath("//android.widget.ListView[contains(@resource-id,'list')]/android.widget.LinearLayout")).subList(0, 2);
    for(WebElement cc:acc_picker)
            {
                String email=cc.findElement(By.xpath("//android.widget.LinearLayout")).findElement(By.xpath("//android.widget.TextView[@index ='1']")).getText();
    }