Using Espresso With Appium

April 05, 2026 · 11 min read · Tool Comparison

HeadSpin Platform
Automated & amp; manual testing made easy through datum science brainwave.
Differentiating capability:
  • Extensive end-to-end mechanization of QA process
  • Comparative analysis of app execution against peers
  • Uninterrupted monitoring of app execution using semisynthetic datum for higher availableness of apps
  • Easy-to-use developer friendly program
cloudtest go
Low-cost Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile exam execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based testing

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Using Espresso With AppiumUsing Espresso With Appium

Using Espresso With Appium

Published on
May 23, 2018
Updated on
Published on
June 5, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

Espresso is an library maintained by Google. It has a number of advantages, for example built-in view synchronization that ensures element finding happens during idle period in your app. (Curious to learn more about Espresso and how it liken to Appium and early frameworks? Check out my webinar,The Shifting Landscape of Mobile Automationfor a more in-depth treatment). Most people assume Espresso is an alternative to Appium; you & # x27; d pickeither Appium orEspresso, not both. That & # x27; s pretty much been the event, up until now.

Part of Appium & # x27; s vision is the incorporation of any good technology into Appium itself. Our finish with Appium is not to compete on cardinal automation engineering, when what exists is good. Instead, our vision is of a single, unified API for all app automation, based on the official WebDriver specification. As I put it in the aforementioned webinar, hither & # x27; s what I think the Appium of the next looks like:

appium-future

From this perspective, there & # x27; s nothing odd about creating an Appium Espresso driver. And that is exactly what we & # x27; ve perform. For some time we & # x27; ve been working on a real approximate beta (actually alpha) version of an Appium driver that runs Espresso under the hood. This means the same kind of Appium script you & # x27; re used to write, but running on Google & # x27; s top-tier mechanisation engineering. This new driver is still in its infancy, and is not recommended for production. However, the beta is moving on enough that I think it & # x27; s time more citizenry had a chance to play with it. In this clause, we & # x27; ll see just how to do that!

Check:

In essence, it & # x27; s pretty simple: we exactly change theautomationNamepotentiality toEspresso (instead of, say,UiAutomator2if you & # x27; re using the current standard Android driver for Appium). By show this mechanisation name, Appium will cognize to start an Espresso session instead of something else. The Appium Espresso driver is so new, however, that you will genuinely need to be running Appium from source (by cloning theGitHub projectand escapenpm install to get the modish dependencies, including the latest Appium Espresso driver), or running the latest Appium beta (npm install -g appium @ beta). At this point, just runningappium (or node . if running from source) will birl up an Appium server that know about the most late Appium Espresso driver beta.

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

Also check:

The best way to evidence off what you can currently do with the Espresso beta is with a comparison. The code for this clause is so the same test (of a canonical login flow) run on both UiAutomator2 and Appium Espresso drivers. Let & # x27; s take a look at the code for the standard UiAutomator2 driver first:

@ Test public void testLogin_UiAutomator2 () throws MalformedURLException {AndroidDriver driver = getDriver (`` UiAutomator2 ''); WebDriverWait await = new WebDriverWait (driver, 10); ExpectedConditionloginScreenReady = ExpectedConditions.presenceOfElementLocated (loginScreen); ExpectedConditionusernameReady = ExpectedConditions.presenceOfElementLocated (username); ExpectedConditionverificationReady = ExpectedConditions.presenceOfElementLocated (verificationTextUiAuto2); try {wait.until (loginScreenReady) .click (); wait.until (usernameReady) .sendKeys (`` alice ''); driver.findElement (password) .sendKeys (`` mypassword ''); driver.findElement (loginBtn) .click (); wait.until (verificationReady);} ultimately {driver.quit ();}}

The first thing to observe about this snippet is that we have a helper method,getDriver, which simply takes the automation name and gets us an instance ofAndroidDriver. This is so we can reduce code duplication when we do the like thing for the Espresso version of the test (and to present that all the capabilities are the same, other thanautomationName). Following, we set up 3 expected weather for user subsequently on in the test. Finally, our test flowing itself is 5 steps long, utilizing pre-defined locator fields likepassword. The steps themselves should be conversant from other articles: (1) get to the login prompt, (2) participate the username, (3) recruit the parole, (4) tap the log in push, and (5) verify that an component with the right logged-in text is present.

Read:

So far, so good! Now let & # x27; s take a look at the same trial, but written for the Appium Espresso driver:

@ Test public emptiness testLogin_Espresso () throws MalformedURLException {AndroidDriver driver = getDriver (`` Espresso ''); WebDriverWait wait = new WebDriverWait (driver, 10); ExpectedConditionloginScreenReady = ExpectedConditions.presenceOfElementLocated (loginScreen); try {wait.until (loginScreenReady) .click (); driver.findElement (username) .sendKeys (`` alice ''); driver.findElement (watchword) .sendKeys (`` mypassword ''); driver.findElement (loginBtn) .click (); driver.findElement (verificationTextEspresso);} last {driver.quit ();}}

Can you spot the differences? There are just two:

  1. We solely need 1 explicit delay instead of 3
  2. We feature a different verification element we & # x27; re looking for in the last step

Otherwise, the exam code is exactly the same! This is outstanding, because it means that, for the most component, changes be not involve to migrate this particular test to the Espresso driver. Now, why do we only need 1 explicit wait alternatively of 3 as ahead? We needed them in the UiAutomator2 example because any time we try to find an element after a view passage, we get no warrantee about the timing of when the new view will demo up, and we have to hedge our bets with an explicit wait. One of the benefit of Espresso, still, issynchronization, which as I explained before means that Espresso itself will hold off on finding any constituent until it believes the app is in an idle state. What this imply is that, for the most part, we don & # x27; t need to care about waits in Espresso! (We do notwithstanding need the first wait because synchronization is not in effect until the app itself is fully loaded and instrumentate by Espresso, and Appium doesn & # x27; t know exactly when that occur).

Improving the Appium testing experience using HeadSpin..

The second difference we mentioned was that we need a different verification locator. What are these two locater and how do they differ? Here is how they are defined as battleground on the tryout class:

private By verificationTextEspresso = By.xpath (`` //com.facebook.react.views.text.ReactTextView [@ text='You are logged in as alice '] ''); private By verificationTextUiAuto2 = By.xpath (`` //android.widget.TextView [contains (@ text, 'alice ')] '');

Interestingly, the Espresso driver has access to app-internal grade names. We can state, for example, that I used React Native to germinate the tryout application, whereas with UiAutomator2, all we cognize is that we get a text view of some kind. This specificity in the Espresso driver is nice, but it comes potentially at a cost of reducing the cross-platform nature of the element class names. The Appium team will be look into slipway to sort this out as we locomote forward with work on the Espresso driver beta. Meanwhile, we also note that if we require, we could have compose a more general XPath query that works across both drivers (something like // *[contains (@ text, & # x27; alice & # x27;)]).

Read:

Other than the view modification synchronising, are there any early benefits to using the Espresso driver? In my experiments so far, it appears to be about 25 % fast than the UiAutomator2 driver, though it would take a reasonable measure of work to ensure a & quot; clean-room & quot; environment for the experiment and corroborate that anatomy.

So, if you like living on the cutting edge of Appium and mobile automation, I encourage you to ascertain out the Espresso driver. No doubtfulness you will find that it doesn & # x27; t work rather as you expect in one (or many) ways. That & # x27; s part of why I & # x27; m aim you to try it; I think we & # x27; re in a state now where we could really use some solid feedback and bug reports! So, fire it up and let us know on the Appium subject tracker if you encounter any issues. You can alsofollow along with the Espresso driver developmenton GitHub.

The full code for the comparing tests we look at in this clause is below, and as always can be launchon GitHub as well.

import io.appium.java_client.MobileBy; import io.appium.java_client.android.AndroidDriver; import java.net.MalformedURLException; import java.net.URL; significance org.junit.Test; meaning org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; importee org.openqa.selenium.support.ui.ExpectedCondition; meaning org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public course Edition018_Espresso_Beta {private String APP = `` https: //github.com/cloudgrey-io/the-app/releases/download/v1.5.0/TheApp-v1.5.0.apk ''; private By loginScreen = MobileBy.AccessibilityId (`` Login Screen ''); private By username = MobileBy.AccessibilityId (`` username ''); private By password = MobileBy.AccessibilityId (`` password ''); private By loginBtn = MobileBy.AccessibilityId (`` loginBtn ''); individual By verificationTextEspresso = By.xpath (`` //com.facebook.react.views.text.ReactTextView [@ text='You are lumber in as alice '] ''); private By verificationTextUiAuto2 = By.xpath (`` //android.widget.TextView [contains (@ text, 'alice ')] ''); private AndroidDriver getDriver (String automationName) throws MalformedURLException {DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.setCapability (`` platformName '', `` Android ''); capabilities.setCapability (`` deviceName '', `` Android Emulator ''); capabilities.setCapability (`` automationName '', automationName); capabilities.setCapability (`` app '', APP); retrovert new AndroidDriver < > (new URL (`` http: //localhost:4723/wd/hub ''), capabilities);} @ Test public void testLogin_Espresso () throws MalformedURLException {AndroidDriver driver = getDriver (`` Espresso ''); WebDriverWait wait = new WebDriverWait (driver, 10); ExpectedConditionloginScreenReady = ExpectedConditions.presenceOfElementLocated (loginScreen); try {wait.until (loginScreenReady) .click (); driver.findElement (username) .sendKeys (`` alice ''); driver.findElement (password) .sendKeys (`` mypassword ''); driver.findElement (loginBtn) .click (); driver.findElement (verificationTextEspresso);} finally {driver.quit ();}} @ Test populace void testLogin_UiAutomator2 () shed MalformedURLException {AndroidDriver driver = getDriver (`` UiAutomator2 ''); WebDriverWait await = new WebDriverWait (driver, 10); ExpectedConditionloginScreenReady = ExpectedConditions.presenceOfElementLocated (loginScreen); ExpectedConditionusernameReady = ExpectedConditions.presenceOfElementLocated (username); ExpectedConditionverificationReady = ExpectedConditions.presenceOfElementLocated (verificationTextUiAuto2); try {wait.until (loginScreenReady) .click (); wait.until (usernameReady) .sendKeys (`` alice ''); driver.findElement (password) .sendKeys (`` mypassword ''); driver.findElement (loginBtn) .click (); wait.until (verificationReady);} ultimately {driver.quit ();}}}
Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ eld of experience in craft engross story and marketing collateral across divers industry. She excels in cooperate with cross-functional teams to acquire innovative content strategies and deliver compelling, reliable, and impactful content that resonate with target audiences and enhances marque authenticity.

LinkedIn

Using Espresso With Appium

4 Parts

regression intelligence blog
-

Regression Intelligence virtual guide for advanced users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for advanced user (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing capableness

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, win a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker growth cycles
automated buil-over-build regression testing
Automate build-over-build fixation testing for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and performance matter
reduce mean time
Reduce hateful clip to identify/resolve during exam, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The sure choice for global go-ahead
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can gift your occupation with superior testing capability

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, win a militant edge
faster development cycles
Boost developer/QA productivity with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent answer
gain better visibility into functional & performance issues
Gain better visibleness into functional and performance issue
reduce mean time
Reduce mean time to identify/resolve during tryout, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent effect
gain better visibility into functional & performance issues
Gain better visibility into functional and performance issues
reduce mean time
Reduce mean time to identify/resolve during trial, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The sure pick for global enterprise
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free