How to Run Your First Appium Test Script
On This Page What is Appium?Key Features of AppiumMay 04, 2026 · 11 min read · Tool Comparison
Appium is a democratic open-source framework use to automate test for aboriginal, hybrid, and mobile web apps on both Android and iOS. It lets you write tests habituate languages like Java, Python, or JavaScript, and run them on real devices or emulators. This article explains how Appium works, how to set it up, and how to run Appium Script locally and on BrowserStack. is an open-source for applications support by assorted program like iOS, Android, macOS, and Windows. It enables the tester to write test book in different program words such as JavaScript, Java, Ruby, Python, PHP, and C #. It also volunteer wherein a single API can be used for both Android and iOS platforms. Appium does not transport dependencies on peregrine operating system. It comprises a wrapper of model that translates Selenium Webdriver command into UIAutomation (iOS) or UIAutomator (Android) require depending on the device type. The OS case does not factor in here. Appium is wide used in mobile automation because it supports real device, multiple speech, and all app types, without need app changes. Below are its well-nigh important capabilities: Read More: Appium follows a client-server architecture built on the WebDriver protocol. It acts as a bridge between the test script and the mobile device (real or practical), enabling platform-independent automation. Here & # 8217; s a breakdown of its nucleus components and how they interact: 1. Appium Client:The client is the test playscript compose in a supported lyric (Java, Python, JavaScript, etc.) using a WebDriver-compatible library. It sends automation commands to the Appium Server. 2. Appium Server:A Node.js-based server that receives requests from the client in the form of JSON over HTTP. It processes these requests and forward them to the relevant mobile mechanization engine depending on the program. 3. Automation Engines:Appium has two engines Read More: 4. Mobile Device (Real or Emulator/Simulator):The device where the actual app is install and tested. The automation locomotive interacts with the OS and app to perform the examination actions. Also Read: 5. Bootstrap Components (Platform-Specific):Appium habituate internal help apps (like Appium Settings or uiautomator2-server for Android) to ease communicating between the waiter and the mobile OS. The following stairs explain how Appium procedure and accomplish a test command within its client-server architecture: Appium can be installed: In this case, let & # 8217; s download using Appium Desktop. 1. Go to release pageand download the late version of Appium, according to your system configuration. 2.Follow the on-screen didactics and instal Appium. 3.Once the apparatus is complete, run the Appium waiter GUI and check for the host and port configuration as shown below: 4.As a next step, go to the Advancedtab and configure the server speech and port as shown in the snapshot below. Now, you can part the server by clicking on theStart Serverbutton shown: 5.Once the Appium server starts, you can see the server status as shown below: For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users. 6.Now, you can connect your mobile device to the scheme through a USB cable. Open the command prompting and run the command:ADB devicesto ensure the details of the device. 7.You will too need to render your mobile phone ’ s Android variant number in the Appium script.To discovery this, open your mobile phone and go toSetting & gt; About Phone. In the About Phonescreen, you can see the Android version as present below: Follow these steps to run the Appium Script. This script would launch the Play Store app on your mobile device. The best way to proceed is to run your script and so monitor the Appium Desktop blind. You will notice that the Appium Desktop screen will start showing some logs. This is how you will know that your Appium test handwriting is running. BrowserStackApp Automateenables you to quiz native and hybrid mobile covering using the Appium mechanization framework on thou of existent Android and iOS devices. It & # 8217; s easy to run Appium tests written in Java on real Android and iOS devices on BrowserStack. Setup Also, copy the codification snippet from the App Automate dashboard to execute the test case. The following Java codification prove how to run an Appium test on BrowserStack using the BrowserStack sample Wikipedia Android app. The test is configure to run on a existent OnePlus 9 device scat Android 11. It automates the following scenario: This test script exerciseDesiredCapabilitiesto specify test parameters and initializes anAndroidDriverinstance to interact with the remote BrowserStack Appium server. The script likewise makes use ofWebDriverWaitto deal synchronization. Note: Replace & # 8220; your_username & # 8221; and & # 8220; your_key & # 8221;with your literal BrowserStack certification. Once ready, run the test locally using your build puppet (like Maven or Gradle). It will fulfil on a real twist hosted on BrowserStack. You are now ready to run your maiden Appium exam on BrowserStack. On your local machine, open the terminal/command prompting and navigate to the booklet check your test script. Build and run the examination script simply like any other Java program using your projection ’ s preferred build tools (E.g. Maven, Gradle). After executing the test case you can see the results on the BrowserStack dashboard. That ’ s how it works. Read more: Even with a well-configured apparatus, Appium scripts can run into assorted number, ranging from configuration errors to platform-specific bugs. Below are some of the nearly mutual trouble and tips on how to resolve them: Appium is a honest choice for automating mobile app testing across platforms. It supports aboriginal, intercrossed, and web apps, works with popular programming languages, and doesn ’ t require change your app. Whether you ’ re testing on Android or iOS, Appium offers the flexibleness to construct robust, maintainable test suites. To take your Appium test farther, run them on real devices with. You get instant access to a wide range of Android and iOS device, tight debugging through video and logs, and seamless desegregation with your CI line. This helps you get device-specific bug early, improve test coverage, and liberation confidently across real exploiter environment. Tutorials Best Practices, Tips, and Tricks Getting Started with Differences and Comparisons # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.How to Run Your First Appium Test Script
What is Appium?
Key Features of Appium
Appium Architecture
Prerequisites for Appium Automation
How to Run Appium Test Script
import java.net.MalformedURLException; import java.net.URL; importee org.openqa.selenium.remote.DesiredCapabilities; import io.appium.java_client.AppiumDriver; signification io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; public class AppiumTestcase {public static void independent (String [] args) {//Set the Desired Capabilities DesiredCapabilities caps = new DesiredCapabilities (); caps.setCapability (`` deviceName '', `` My Phone ''); caps.setCapability (`` udid '', `` twist id ''); //Give Device ID caps.setCapability (`` platformName '', `` Android ''); caps.setCapability (`` platformVersion '', `` 11.0 ''); caps.setCapability (`` appPackage '', `` com.android.vending ''); caps.setCapability (`` appActivity '', `` com.google.android.finsky.activities.MainActivity ''); caps.setCapability (`` noReset '', `` true ''); //Instantiate Appium Driver try {AppiumDriver driver = new AndroidDriver (new URL (`` http: //0.0.0.0:4723/wd/hub ''), caps);} catch (MalformedURLException e) {System.out.println (e.getMessage ());}}}Run Appium Test Script on BrowserStack
// Maven users can add this dependency to project 's POM & lt; dependency & gt; & lt; groupId & gt; io.appium & lt; /groupId & gt; & lt; artifactId & gt; java-client & lt; /artifactId & gt; & lt; version & gt; 7.0.0 & lt; /version & gt; & lt; /dependency & gt;
/ * Note the `` app_url '' value for the sample app. This value uniquely identifies the app on BrowserStack. * / {`` app_url '': '' bs: //c700ce60cf13ae8ed97705a55b8e022f13c5827c ''} / * In your test script, use this `` app_url '' value to specify the application under test using the `` app '' capability. During test execution, the sampling app will automatically be installed and launched on the device being tested. * / caps.setCapability (`` app '', `` bs: //c700ce60cf13ae8ed97705a55b8e022f13c5827c '')Execution of Appium Test Script:
package android; import java.net.URL; import java.util.List; import java.util.function.Function; importee java.net.MalformedURLException; import io.appium.java_client.MobileBy; import io.appium.java_client.android.AndroidDriver; importation io.appium.java_client.android.AndroidElement; signification org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.WebDriver; meaning org.openqa.selenium.remote.DesiredCapabilities; public class BrowserStackSample {public static void main (String [] args) throws MalformedURLException, InterruptedException {DesiredCapabilities caps = new DesiredCapabilities (); // Set your access credentials caps.setCapability (`` browserstack.user '', `` your_username ''); caps.setCapability (`` browserstack.key '', `` your_key ''); // Set URL of the coating under test caps.setCapability (`` app '', `` bs: //c700ce60cf13ae8ed97705a55b8e022f13c5827c ''); // Specify gimmick and os_version for try caps.setCapability (`` device '', `` OnePlus OnePlus 9 ''); caps.setCapability (`` os_version '', `` 11.0 ''); // Set other BrowserStack capabilities caps.setCapability (`` undertaking '', `` First Java Project ''); caps.setCapability (`` build '', `` browserstack-build-1 ''); caps.setCapability (`` name '', `` first_test ''); // Initialize the remote Webdriver utilise BrowserStack remote URL // and desired capabilities defined above AndroidDriver & lt; AndroidElement & gt; driver = new AndroidDriver & lt; AndroidElement & gt; (new URL (`` http: //hub.browserstack.com/wd/hub ''), caps); // Test case for the BrowserStack sample Android app. // If you have uploaded your app, update the test causa here. AndroidElement searchElement = (AndroidElement) new WebDriverWait (driver, 30) .until (ExpectedConditions.elementToBeClickable (MobileBy.AccessibilityId (`` Search Wikipedia ''))); searchElement.click (); AndroidElement insertTextElement = (AndroidElement) new WebDriverWait (driver, 30) .until (ExpectedConditions.elementToBeClickable (MobileBy.id (`` org.wikipedia.alpha: id/search_src_text ''))); insertTextElement.sendKeys (`` BrowserStack ''); Thread.sleep (5000); List & lt; AndroidElement & gt; allProductsName = driver.findElementsByClassName (`` android.widget.TextView ''); assert (allProductsName.size () & gt; 0); // Invoke driver.quit () after the test is done to indicate that the test is finish. driver.quit ();}}# Using Maven mvn test -P & lt; android-first-test & gt;
Troubleshooting Errors and Common Problems in Appium Script
Conclusion
Useful Resources for Appium
Related Guides
Automate This With SUSA
Test Your App Autonomously