Set Play Store credentials in Appium tests

Publish date: 2024-05-19

You can log in to a Google account on a BrowserStack device to test:

  • Google in-app purchase flows.
  • Accepting payments using Google Pay.
  • Integration of your app with other Google apps (e.g. Google Calendar).
  • Production version of your apps by downloading it from the Google Play Store.
  • Use the app store configuration capability to pass your credentials to login Google Play Store:

    If you are using BrowserStack SDK, you can set the following capability within the browserstack.yml file:

    CapabilityDescriptionValues
    appStoreConfigurationSet credentials for Google account login"username" : "play-store-email"
    "password" : "play-store-password"

    BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

    Use the following code snippet to pass your credentials to login Google Play Store:

    CapabilityDescriptionValues
    appStoreConfigurationSet credentials for Google account login"username" : "play-store-email"
    "password" : "play-store-password"

    Example:

    DesiredCapabilities capabilities = new DesiredCapabilities(); HashMap<String, Object> browserstackOptions = new HashMap<String, Object>(); browserstackOptions.put("appStoreConfiguration", new HashMap<String, String>() ); 
    var capabilities = { 'bstack:options' : { "appStoreConfiguration" : {"username" : "your_email", "password" : "your_password" }, } } 
    AppiumOptions capabilities = new AppiumOptions(); Dictionary<string, string> appStoreConfiguration = new Dictionary<string, string> { { "username", "your_email" }, { "password", "your_password" } }; browserstackOptions.Add("appStoreConfiguration", appStoreConfiguration); 
    $caps = array( 'bstack:options' => array( "appStoreConfiguration" => array("username" => "your_email", "password" => "your_password" ), ), ) 
    capabilities = { 'bstack:options' => { "appStoreConfiguration" => {"username" => "your_email", "password" => "your_password" }, }, } 
    CapabilityDescriptionValues
    browserstack.appStoreConfigurationSet credentials for Google account login{"username" : "play-store-email", "password" : "play-store-password"}

    Example:

    DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability("browserstack.appStoreConfiguration", new HashMap{String, String}(){ put("username", "your_email"); put("password", "your_password");}); 
    var capabilities = { 'browserstack.appStoreConfiguration': '{"username":"your_email", "password":"your_password"}' } 
    DesiredCapabilities capability = new DesiredCapabilities(); capability.SetCapability("browserstack.appStoreConfiguration", "{"username":"your_email", "password":"your_password"}"); 
    $capabilities = new DesiredCapabilities(); $capabilities->setCapability("browserstack.appStoreConfiguration", array("username" => "your_email", "password" => "your_password")); 
    desired_caps = { 'browserstack.appStoreConfiguration': '{"username":"your_email", "password":"your_password"}' } 

    Troubleshooting Google login issues

    During test initialization, BrowserStack will attempt to log in on the tested device using specified Google account credentials. In some cases, Google may pose a Two-Factor Authentication (2FA) that requires you to approve login using a trusted device or an One-Time Password (OTP) or by some other means. This will fail your test build. To fix this:

  • Use a newly created Google account to sign in. Ensure that the account was never used to log in on any other device or browser.
  • Turn off the account’s security settings - 2 Step verification and Use your phone to sign in
  • Ensure that 1 google account is not used for login in multiple parallel sessions (keep the parallel runs below 5 preferably)
  • If you observe increased flakiness, create a new account as sometimes Google suspects malicious usage if same account has been used from multiple different devices which becomes unavoidable in a public cloud setting like ours.
  • If you are still facing issues with Google account login, please reach out to BrowserStack support.

    Your Google account credentials are secure as we wipe the devices clean at the end of your test session

    Did this page help you?

    Yes No

    We're sorry to hear that. Please share your feedback so we can do better

    Submit

    Contact our Support team for immediate help while we work on improving our docs.

    We're continuously improving our docs. We'd love to know what you liked


    Any additional feedback?

    Submit

    Thank you for your valuable feedback

    Is this page helping you?

    Yes No

    We're sorry to hear that. Please share your feedback so we can do better

    Submit Skip

    Contact our Support team for immediate help while we work on improving our docs.

    We're continuously improving our docs. We'd love to know what you liked


    Any additional feedback?

    Submit Skip

    Thank you for your valuable feedback!

    ncG1vNJzZmivp6x7o77OsKqeqqOprqS3jZympmeUpLC0e8Cpp2aZpam8rq3TnmaaqKCewq57wJ2tmqaTmrFussSaq66qlah8tLHTrqdmn5%2BktK2xjJqanKelo8E%3D