{"id":4539,"date":"2022-06-22T11:36:37","date_gmt":"2022-06-22T09:36:37","guid":{"rendered":"https:\/\/betterqa.co\/?p=4539"},"modified":"2026-07-11T19:27:43","modified_gmt":"2026-07-11T17:27:43","slug":"getting-started-with-appium","status":"publish","type":"post","link":"https:\/\/betterqa.co\/getting-started-with-appium\/","title":{"rendered":"Getting Started with Appium &#8211; A Beginner&#8217;s Guide"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"4539\" class=\"elementor elementor-4539\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e395030 elementor-section-full_width elementor-section-height-default elementor-section-height-default\" data-id=\"e395030\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fcc0ffe\" data-id=\"fcc0ffe\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-af2c58b elementor-widget elementor-widget-html\" data-id=\"af2c58b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<style>\n    :root {\n      --bqa-purple: #9152DE;\n      --bqa-deep-purple: #5F29A1;\n      --bqa-blue: #204782;\n      --bqa-light-bg: #f8f9fa;\n      --bqa-border: #e0e0e0;\n    }\n    * { box-sizing: border-box; margin: 0; padding: 0; }\n    body { font-family: 'Roboto', sans-serif; line-height: 1.7; color: #333; background: #fff; }\n    .bqa-article { max-width: 100%; margin: 0 auto; padding: 40px 20px; }\n    .bqa-article h1 { font-family: 'Jost', sans-serif; font-size: 2.2rem; font-weight: 600; color: #1a1a1a; margin-bottom: 1rem; line-height: 1.3; }\n    .bqa-article h2 { font-family: 'Jost', sans-serif; font-size: 1.5rem; font-weight: 600; color: var(--bqa-deep-purple); margin: 2.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--bqa-purple); }\n    .bqa-article h3 { font-family: 'Jost', sans-serif; font-size: 1.2rem; font-weight: 600; color: #1a1a1a; margin: 1.5rem 0 0.75rem; }\n    .bqa-article p { margin-bottom: 1rem; }\n    .bqa-article ul, .bqa-article ol { margin: 1rem 0 1.5rem 1.5rem; }\n    .bqa-article li { margin-bottom: 0.5rem; }\n    .bqa-article a { color: var(--bqa-purple); text-decoration: none; }\n    .bqa-article a:hover { text-decoration: underline; }\n    .bqa-article strong { font-weight: 500; }\n    .bqa-article code { background: #f4f4f4; padding: 2px 6px; border-radius: 3px; font-family: 'Fira Code', monospace; font-size: 0.9em; }\n\n    \/* Stats row *\/\n    .bqa-stats-row { display: flex; gap: 1rem; margin: 2rem 0; flex-wrap: wrap; }\n    .bqa-stat { flex: 1; min-width: 150px; background: linear-gradient(135deg, var(--bqa-deep-purple), var(--bqa-purple)); color: #fff; padding: 1.25rem; border-radius: 8px; text-align: center; }\n    .bqa-stat-value { display: block; font-family: 'Jost', sans-serif; font-size: 1.8rem; font-weight: 600; }\n    .bqa-stat-label { display: block; font-size: 0.85rem; opacity: 0.9; margin-top: 0.25rem; }\n\n    \/* Code block *\/\n    .bqa-code { background: #1e1e1e; color: #d4d4d4; padding: 1.25rem; border-radius: 8px; margin: 1rem 0 1.5rem; overflow-x: auto; font-family: 'Fira Code', monospace; font-size: 0.85rem; line-height: 1.5; }\n    .bqa-code-label { background: var(--bqa-purple); color: #fff; font-size: 0.75rem; padding: 0.25rem 0.75rem; border-radius: 4px 4px 0 0; display: inline-block; margin-bottom: -8px; position: relative; z-index: 1; }\n\n    \/* Highlight box *\/\n    .bqa-highlight { background: var(--bqa-light-bg); border-left: 4px solid var(--bqa-purple); padding: 1.25rem 1.5rem; margin: 1.5rem 0; border-radius: 0 8px 8px 0; }\n    .bqa-highlight p:last-child { margin-bottom: 0; }\n\n    \/* Spec card *\/\n    .bqa-spec-card { background: #fff; border: 1px solid var(--bqa-border); border-radius: 8px; padding: 1.5rem; margin: 1.5rem 0; position: relative; }\n    .bqa-spec-card::before { content: ''; position: absolute; top: 0; left: 0; width: 12px; height: 12px; border-top: 2px solid var(--bqa-purple); border-left: 2px solid var(--bqa-purple); }\n    .bqa-spec-card::after { content: ''; position: absolute; top: 0; right: 0; width: 12px; height: 12px; border-top: 2px solid var(--bqa-purple); border-right: 2px solid var(--bqa-purple); }\n    .bqa-spec-card h3 { margin-top: 0; }\n\n    \/* Table *\/\n    .bqa-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.95rem; }\n    .bqa-table th { background: var(--bqa-deep-purple); color: #fff; padding: 0.75rem 1rem; text-align: left; font-weight: 500; }\n    .bqa-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--bqa-border); }\n    .bqa-table tr:hover td { background: #f8f8f8; }\n    .bqa-table code { background: #eee; }\n\n    \/* Warning box *\/\n    .bqa-warning { background: #fff8e6; border: 1px solid #ffc107; border-radius: 8px; padding: 1.25rem 1.5rem; margin: 1.5rem 0; }\n    .bqa-warning h3 { color: #856404; margin-top: 0; font-size: 1.1rem; }\n\n    \/* Process steps *\/\n    .bqa-process { margin: 1.5rem 0; padding-left: 0; list-style: none; }\n    .bqa-process li { position: relative; padding-left: 2.5rem; margin-bottom: 1rem; padding-bottom: 1rem; border-left: 2px solid var(--bqa-purple); }\n    .bqa-process li:last-child { border-left-color: transparent; }\n    .bqa-process li::before { content: counter(step); counter-increment: step; position: absolute; left: -12px; top: 0; width: 24px; height: 24px; background: var(--bqa-purple); color: #fff; border-radius: 50%; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; font-weight: 600; }\n    .bqa-process { counter-reset: step; }\n\n    \/* CTA *\/\n    .bqa-cta { background: linear-gradient(135deg, var(--bqa-deep-purple), var(--bqa-blue)); color: #fff; padding: 2rem; border-radius: 12px; margin: 2.5rem 0; text-align: center; }\n    .bqa-cta p { color: #fff; margin-bottom: 1rem; }\n    .bqa-cta a { display: inline-block; background: #fff; color: var(--bqa-deep-purple); padding: 0.75rem 2rem; border-radius: 6px; font-weight: 500; text-decoration: none; }\n    .bqa-cta a:hover { background: #f0f0f0; text-decoration: none; }\n\n    @media (max-width: 600px) {\n      .bqa-article h1 { font-size: 1.75rem; }\n      .bqa-stats-row { flex-direction: column; }\n      .bqa-stat { min-width: 100%; }\n      .bqa-table { font-size: 0.85rem; }\n      .bqa-table th, .bqa-table td { padding: 0.5rem; }\n    }\n  <\/style>\n\n<div class=\"bqa-article\">\n\n<h1>Getting started with Appium 3 - mobile automation testing guide<\/h1>\n\n<div class=\"bqa-stats-row\">\n  <div class=\"bqa-stat\">\n    <span class=\"bqa-stat-value\">2<\/span>\n    <span class=\"bqa-stat-label\">Platforms (iOS + Android)<\/span>\n  <\/div>\n  <div class=\"bqa-stat\">\n    <span class=\"bqa-stat-value\">W3C<\/span>\n    <span class=\"bqa-stat-label\">WebDriver protocol<\/span>\n  <\/div>\n  <div class=\"bqa-stat\">\n    <span class=\"bqa-stat-value\">OSS<\/span>\n    <span class=\"bqa-stat-label\">Open source<\/span>\n  <\/div>\n<\/div>\n\n<h2>What is Appium?<\/h2>\n\n<p>Appium is an open-source automation framework for testing mobile applications. It supports native apps (built for iOS or Android), mobile web apps (accessed through a browser), and hybrid apps (web content wrapped in a native container).<\/p>\n\n<p>What makes Appium useful is cross-platform support. You write tests using the W3C WebDriver protocol, and Appium translates those commands into platform-specific actions. One test framework can cover both iOS and Android.<\/p>\n\n<h2>Appium 3 vs Appium 2<\/h2>\n\n<p>Appium 3 was released in August 2025 with important updates. If you are starting fresh, use Appium 3:<\/p>\n\n<div class=\"bqa-spec-card\">\n  <ul>\n    <li><strong>Node.js 20+ required<\/strong> - minimum Node v20.19.0 or v22.12.0+ (up from Node 14 in Appium 2)<\/li>\n    <li><strong>Driver-based architecture<\/strong> - install only the platform drivers you need (UiAutomator2 for Android, XCUITest for iOS)<\/li>\n    <li><strong>Scoped feature flags<\/strong> - <code>--allow-insecure<\/code> now requires scope prefixes<\/li>\n    <li><strong>New session discovery<\/strong> - <code>GET \/appium\/sessions<\/code> replaces <code>GET \/sessions<\/code><\/li>\n    <li><strong>Express 5<\/strong> - updated underlying server framework<\/li>\n  <\/ul>\n<\/div>\n\n<p>Migration from Appium 2 to 3 is simpler than 1 to 2. The examples in this guide are for Appium 3.<\/p>\n\n<h2>Prerequisites<\/h2>\n\n<div class=\"bqa-highlight\">\n  <p><strong>For Android testing:<\/strong><\/p>\n  <ul>\n    <li>Node.js 20+ and npm 10+ (required for Appium 3)<\/li>\n    <li>Java Development Kit (JDK) 17+ (LTS recommended)<\/li>\n    <li>Android Studio with Android SDK<\/li>\n    <li><code>ANDROID_HOME<\/code> and <code>JAVA_HOME<\/code> environment variables set<\/li>\n    <li>At least one Android emulator or physical device with USB debugging enabled<\/li>\n  <\/ul>\n<\/div>\n\n<div class=\"bqa-highlight\">\n  <p><strong>For iOS testing (macOS only):<\/strong><\/p>\n  <ul>\n    <li>Node.js 20+ and npm 10+ (required for Appium 3)<\/li>\n    <li>Xcode 15+ with command-line tools<\/li>\n    <li>At least one iOS simulator or physical device<\/li>\n  <\/ul>\n<\/div>\n\n<h2>Installation<\/h2>\n\n<div class=\"bqa-code-label\">Terminal<\/div>\n<pre class=\"bqa-code\"># Install Appium 3 globally (requires Node 20+)\nnpm install -g appium\n\n# Install the Android driver\nappium driver install uiautomator2\n\n# Install the iOS driver (macOS only)\nappium driver install xcuitest\n\n# Verify installation\nappium driver list --installed<\/pre>\n\n<p>Run <code>appium<\/code> in a terminal to start the server. You should see output confirming the server is running on <code>http:\/\/127.0.0.1:4723<\/code>.<\/p>\n\n<h2>Verifying your setup<\/h2>\n\n<p>Appium provides a doctor command that checks your environment:<\/p>\n\n<div class=\"bqa-code-label\">Terminal<\/div>\n<pre class=\"bqa-code\"># Install the doctor plugin\nappium plugin install --source=npm appium-doctor\n\n# Check Android setup\nnpx appium-doctor --android\n\n# Check iOS setup\nnpx appium-doctor --ios<\/pre>\n\n<p>Fix any issues it reports before proceeding.<\/p>\n\n<h2>Writing your first test<\/h2>\n\n<p>Here is a minimal test that opens an app and interacts with it. This example uses JavaScript with WebDriverIO, the most popular Appium client.<\/p>\n\n<div class=\"bqa-code-label\">Terminal<\/div>\n<pre class=\"bqa-code\"># Create a project\nmkdir appium-demo && cd appium-demo\nnpm init -y\nnpm install webdriverio<\/pre>\n\n<p>Create a file called <code>test.js<\/code>:<\/p>\n\n<div class=\"bqa-code-label\">test.js<\/div>\n<pre class=\"bqa-code\">const { remote } = require('webdriverio');\n\nasync function main() {\n  const driver = await remote({\n    hostname: '127.0.0.1',\n    port: 4723,\n    capabilities: {\n      platformName: 'Android',\n      'appium:automationName': 'UiAutomator2',\n      'appium:app': '\/path\/to\/your\/app.apk',\n    }\n  });\n\n  \/\/ Wait for the app to load\n  await driver.pause(2000);\n\n  \/\/ Find an element and interact with it\n  const element = await driver.$('~search_button');\n  await element.click();\n\n  \/\/ Verify something\n  const searchField = await driver.$('~search_src_text');\n  const isDisplayed = await searchField.isDisplayed();\n  console.log('Search field visible:', isDisplayed);\n\n  await driver.deleteSession();\n}\n\nmain().catch(console.error);<\/pre>\n\n<p>Run it while Appium server and an emulator are active:<\/p>\n\n<div class=\"bqa-code-label\">Terminal<\/div>\n<pre class=\"bqa-code\">node test.js<\/pre>\n\n<h2>Key Appium concepts<\/h2>\n\n<h3>Desired capabilities<\/h3>\n\n<p>Desired capabilities tell Appium what device and app to use:<\/p>\n\n<table class=\"bqa-table\">\n  <thead>\n    <tr>\n      <th>Capability<\/th>\n      <th>Purpose<\/th>\n      <th>Example<\/th>\n    <\/tr>\n  <\/thead>\n  <tbody>\n    <tr>\n      <td><code>platformName<\/code><\/td>\n      <td>Target OS<\/td>\n      <td><code>Android<\/code> or <code>iOS<\/code><\/td>\n    <\/tr>\n    <tr>\n      <td><code>appium:automationName<\/code><\/td>\n      <td>Driver to use<\/td>\n      <td><code>UiAutomator2<\/code> or <code>XCUITest<\/code><\/td>\n    <\/tr>\n    <tr>\n      <td><code>appium:app<\/code><\/td>\n      <td>Path to APK\/IPA<\/td>\n      <td><code>\/path\/to\/app.apk<\/code><\/td>\n    <\/tr>\n    <tr>\n      <td><code>appium:deviceName<\/code><\/td>\n      <td>Device or emulator<\/td>\n      <td><code>Pixel_7_API_34<\/code><\/td>\n    <\/tr>\n    <tr>\n      <td><code>appium:platformVersion<\/code><\/td>\n      <td>OS version<\/td>\n      <td><code>14.0<\/code><\/td>\n    <\/tr>\n  <\/tbody>\n<\/table>\n\n<h3>Locator strategies<\/h3>\n\n<table class=\"bqa-table\">\n  <thead>\n    <tr>\n      <th>Strategy<\/th>\n      <th>Notes<\/th>\n    <\/tr>\n  <\/thead>\n  <tbody>\n    <tr>\n      <td><code>accessibility id<\/code><\/td>\n      <td>Best option - works cross-platform<\/td>\n    <\/tr>\n    <tr>\n      <td><code>id<\/code><\/td>\n      <td>Android resource ID (e.g., <code>com.app:id\/button<\/code>)<\/td>\n    <\/tr>\n    <tr>\n      <td><code>xpath<\/code><\/td>\n      <td>Powerful but slow and fragile - use as last resort<\/td>\n    <\/tr>\n    <tr>\n      <td><code>class name<\/code><\/td>\n      <td>Element type (e.g., <code>android.widget.Button<\/code>)<\/td>\n    <\/tr>\n    <tr>\n      <td><code>-android uiautomator<\/code><\/td>\n      <td>Android-specific UiSelector queries<\/td>\n    <\/tr>\n    <tr>\n      <td><code>-ios predicate string<\/code><\/td>\n      <td>iOS-specific NSPredicate queries<\/td>\n    <\/tr>\n  <\/tbody>\n<\/table>\n\n<h2>Appium Inspector<\/h2>\n\n<p>Appium Inspector is a GUI tool that helps you find elements in your app. It shows the app's element tree and lets you try different locator strategies before writing code.<\/p>\n\n<p>Install it from <a href=\"https:\/\/github.com\/appium\/appium-inspector\/releases\" rel=\"nofollow noopener\" target=\"_blank\">github.com\/appium\/appium-inspector<\/a>. Connect to your running Appium server, start a session, and click on elements to see their properties.<\/p>\n\n<p>This is the fastest way to build reliable selectors for your tests.<\/p>\n\n<h2>Best practices<\/h2>\n\n<div class=\"bqa-spec-card\">\n  <h3>Use accessibility IDs as your primary locator<\/h3>\n  <p>They are stable, fast, and work on both iOS and Android. Ask developers to add <code>contentDescription<\/code> (Android) and <code>accessibilityIdentifier<\/code> (iOS) to testable elements.<\/p>\n<\/div>\n\n<div class=\"bqa-spec-card\">\n  <h3>Keep tests independent<\/h3>\n  <p>Each test should start from a clean state. Use <code>driver.resetApp()<\/code> or reinstall the app between tests to avoid state leakage.<\/p>\n<\/div>\n\n<div class=\"bqa-spec-card\">\n  <h3>Handle waits explicitly<\/h3>\n  <p>Mobile apps are slow. Use explicit waits (<code>driver.waitUntil<\/code>) instead of fixed pauses. Fixed pauses make tests slow and flaky.<\/p>\n<\/div>\n\n<div class=\"bqa-spec-card\">\n  <h3>Run on real devices for final validation<\/h3>\n  <p>Emulators and simulators are fast for development, but they miss real-world issues like Bluetooth, camera, GPS, and performance on lower-end hardware.<\/p>\n<\/div>\n\n<h2>Common issues and fixes<\/h2>\n\n<div class=\"bqa-warning\">\n  <h3>Troubleshooting<\/h3>\n  <ul>\n    <li><strong>\"Could not find adb\"<\/strong> - your <code>ANDROID_HOME<\/code> is not set correctly. Add it to your shell profile.<\/li>\n    <li><strong>Session creation timeout<\/strong> - the emulator is not fully booted. Wait for the home screen before starting the test.<\/li>\n    <li><strong>Element not found<\/strong> - the element has not loaded yet. Add an explicit wait, or the locator strategy is wrong. Use Appium Inspector to verify.<\/li>\n    <li><strong>Tests pass on emulator but fail on device<\/strong> - real devices have different performance characteristics. Add longer waits and check for device-specific UI differences.<\/li>\n  <\/ul>\n<\/div>\n\n<h2>Next steps<\/h2>\n\n<ol class=\"bqa-process\">\n  <li>Set up a test framework (WebDriverIO with Mocha, or Pytest with Appium-Python-Client)<\/li>\n  <li>Organize tests by feature using the page object pattern<\/li>\n  <li>Add your tests to CI\/CD (GitHub Actions, Jenkins, or GitLab CI)<\/li>\n  <li>Expand to cover your most critical user flows<\/li>\n<\/ol>\n\n<div class=\"bqa-cta\">\n  <p>For teams that need help building mobile automation from scratch, BetterQA's automation engineers design and maintain Appium test suites for iOS and Android across industries from fintech to healthcare.<\/p>\n  <a href=\"https:\/\/betterqa.co\/software-testing-services\/test-automation\/\">Talk to our team<\/a>\n<\/div>\n\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Getting started with Appium for mobile testing. Beginner guide to mobile app automation testing framework.<\/p>\n","protected":false},"author":33,"featured_media":4540,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[84,1002,915],"tags":[742,758,754,741],"class_list":["post-4539","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation-testing","category-automation-tools-and-frameworks","category-web-mobile-testing","tag-softwaretesting","tag-softwareengineers","tag-testers","tag-testing"],"acf":[],"_links":{"self":[{"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/posts\/4539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/comments?post=4539"}],"version-history":[{"count":0,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/posts\/4539\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/media\/4540"}],"wp:attachment":[{"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/media?parent=4539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/categories?post=4539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/betterqa.co\/wp-json\/wp\/v2\/tags?post=4539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}