### Start Appium Server Source: https://appium.io/docs/en/3.1/quickstart/install Launches the Appium server process from the command line. This command starts the server, loads installed drivers, and listens for new session requests from client applications. The server output will display connection URLs. ```bash appium ``` -------------------------------- ### Install Appium Globally with npm Source: https://appium.io/docs/en/3.1/quickstart/install Installs the Appium package globally on your system using npm. Ensure Node.js and npm are installed and meet system requirements before running this command. This is the primary method for installing Appium. ```bash npm install -g appium ``` -------------------------------- ### SwiftAppium Installation and Setup Source: https://appium.io/docs/en/3.1/ecosystem/clients Clone the SwiftAppium repository, build the project, and run the executable. This process sets up the SwiftAppium framework for iOS testing. ```bash git clone https://github.com/milcgroup/SwiftAppium.git cd SwiftAppium swift build swift run swiftappium ``` -------------------------------- ### Activating Plugins on Appium Server Start Source: https://appium.io/docs/en/3.1/developing/build-plugins Illustrates how to activate installed plugins when starting the Appium server. Users need to specify the plugin names using the `--use-plugins` flag for the server to load and enable them. ```bash appium --use-plugins=plugin-name ``` -------------------------------- ### Use Appium Setup CLI for Mobile Drivers Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 Utilizes the Appium Setup CLI to install necessary mobile automation drivers. This command streamlines the setup process for common mobile automation needs, available from Appium version 2.6 onwards. ```bash appium setup mobile ``` -------------------------------- ### Verify Available Appium Drivers After Installation Source: https://appium.io/docs/en/3.1/quickstart/uiauto2-driver This output snippet shows the Appium server's status after it has been started. It lists all currently available drivers, confirming that the newly installed 'uiautomator2' driver with its version and automation name is recognized and ready for use. ```logs [Appium] Available drivers: [Appium] - uiautomator2@2.0.5 (automationName 'UiAutomator2') ``` -------------------------------- ### Set up Driver Constructor Source: https://appium.io/docs/en/3.1/developing/build-drivers Example of a driver constructor that calls the superclass constructor and then adds custom initialization. It ensures standard state setup before custom logic. ```javascript constructor(...args) { super(...args); // now do your own thing } ``` -------------------------------- ### Common Appium Commands in Multiple Languages Source: https://appium.io/docs/en/3.1/intro/clients This snippet demonstrates a common set of Appium automation commands (Find Element, Click Element, Get Element Text, Get Page Source) implemented in JavaScript, Java, Python, Ruby, and C#. These examples showcase how Appium client libraries abstract the underlying HTTP API, providing a native feel for each programming language. Note that full setup and import details are omitted; refer to individual client library documentation. ```javascript const element = await driver.$('//*[@text="Foo"]'); await element.click(); console.log(await element.getText()) console.log(await driver.getPageSource()) ``` ```java WebElement element = driver.findElement(By.Xpath("//*[@text='Foo']")) element.click() System.out.println(element.getText()) System.out.println(driver.getPageSource()) ``` ```python element = driver.find_element(by=By.XPATH, value='//*[@text="Foo"]') element.click() print(element.text) print(driver.page_source) ``` ```ruby element = driver.find_element :xpath, '//*[@text="Foo"]' element.click puts element.text puts driver.page_source ``` ```csharp AppiumElement element = driver.FindElement(MobileBy.AccessibilityId("Views")); element.click(); System.Console.WriteLine(element.Text); System.Console.WriteLine(driver.PageSource); ``` -------------------------------- ### Install Appium 2 with Specific Drivers (npm) Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 Installs Appium 2 globally using npm, specifying desired drivers to be installed alongside the core server. This command is an alternative to using the Appium Extension CLI for initial driver setup. ```bash npm i -g appium --drivers=xcuitest,uiautomator2 ``` -------------------------------- ### Ruby Core Client Installation Source: https://appium.io/docs/en/3.1/ecosystem/clients Instructions to install the Appium Ruby Core Client from RubyGems. This client provides a foundational interface for interacting with Appium. Use the `gem` command for installation. ```bash gem install appium_lib_core ``` -------------------------------- ### Starting Appium and Selenium Grid Processes Source: https://appium.io/docs/en/3.1/guides/grid Commands to launch Appium servers and Selenium Grid nodes/hub. This setup involves running multiple processes, each in a separate terminal for clarity of logs. ```bash appium --config appium1.yml appium --config appium2.yml java -jar /path/to/selenium.jar node --config node1.toml java -jar /path/to/selenium.jar node --config node2.toml java -jar /path/to/selenium.jar hub ``` -------------------------------- ### WebdriverIO Setup Source: https://appium.io/docs/en/3.1/ecosystem/clients Initialize a new WebdriverIO project using npm. This command scaffolds a new WebdriverIO setup, which can then be configured to work with Appium. ```bash npm init wdio@latest . ``` -------------------------------- ### Install Appium Installer CLI Tool Source: https://appium.io/docs/en/3.1/ecosystem/tools Appium Installer is a command-line utility designed to simplify the setup of Appium testing environments. It facilitates the installation of Appium itself, along with its various drivers and plugins, and can also validate prerequisite configurations for emulators and real devices on iOS and Android. ```bash npm install -g appium-installer ``` -------------------------------- ### Plugin Installation and Activation Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 Advanced features like image-related operations and Execute Driver Script are now managed as plugins. Users need to install these plugins separately and activate them when starting the Appium server. ```APIDOC ## Plugin Installation and Activation ### Description Appium 2 modularizes advanced features into plugins. To use features previously bundled with Appium 1, such as image-related functionalities or the Execute Driver Script feature, you must install and activate the corresponding plugins. ### Method CLI Commands ### Endpoint N/A ### Parameters N/A ### Request Example (Install Plugins) ```bash appium plugin install images appium plugin install execute-driver ``` ### Request Example (Activate Plugins on Server Start) ```bash appium --use-plugins=images,execute-driver ``` ### Response N/A (CLI commands) ``` -------------------------------- ### Ruby Client Installation Source: https://appium.io/docs/en/3.1/ecosystem/clients How to install the Appium Ruby Client from RubyGems. This client is a wrapper around the Ruby Core Client and offers additional helper methods. It is installed using the `gem` command. ```bash gem install appium_lib ``` -------------------------------- ### Install Appium Driver or Plugin Source: https://appium.io/docs/en/3.1/reference/cli/extensions Installs an Appium driver or plugin extension. The installation can be from an official registry, a specific npm version, a local path, a Git repository, or a GitHub URL. The `--source` option dictates the format of the `` argument. ```bash appium {driver|plugin} install ``` ```bash appium driver install xcuitest ``` ```bash appium driver install xcuitest@9.0.0 ``` ```bash appium driver install @appium/fake-driver@beta --source=npm ``` ```bash appium plugin install /path/to/my/plugin --source=local ``` ```bash appium driver install https://github.com/appium/appium-xcuitest-driver --source=github --package=appium-xcuitest-driver ``` ```bash appium driver install git://github.com/appium/appium-xcuitest-driver.git --source=git --package=appium-xcuitest-driver ``` -------------------------------- ### Start Appium Server with SSL/TLS Source: https://appium.io/docs/en/3.1/guides/tls Enables secure connections to the Appium server by specifying paths to an X509 PEM certificate and its private key. Requires both arguments to be provided for a valid SSL/TLS setup. Clients must support SSL/TLS or SPDY to communicate with the server. ```bash appium server --ssl-cert-path=/path/to/cert.pem --ssl-key-path=/path/to/key.pem ``` -------------------------------- ### Installing Appium Plugin Locally Source: https://appium.io/docs/en/3.1/developing/build-plugins Provides the command-line instruction to install an Appium plugin directly from a local directory. This is useful for testing your plugin during development before publishing it. ```bash appium plugin install --source=local /path/to/your/plugin ``` -------------------------------- ### Python Client Installation Source: https://appium.io/docs/en/3.1/ecosystem/clients How to install the Appium Python client from PyPi. This command uses pip, the standard package installer for Python, to add the client to your project's environment. ```bash pip install Appium-Python-Client ``` -------------------------------- ### RobotFramework AppiumLibrary Installation Source: https://appium.io/docs/en/3.1/ecosystem/clients Install the Robot Framework AppiumLibrary from PyPi. This library allows you to use Appium within Robot Framework test cases. Use pip for installation. ```bash pip install robotframework-appiumlibrary ``` -------------------------------- ### Installing Appium Plugin from NPM Source: https://appium.io/docs/en/3.1/developing/build-plugins Shows the command to install an Appium plugin published on NPM. This is the standard method for users to add plugins to their Appium environment. ```bash appium plugin install --source=npm ``` -------------------------------- ### Install Appium Driver Locally Source: https://appium.io/docs/en/3.1/developing/build-drivers Installs an Appium driver from a local directory. This is useful for testing drivers during development. ```bash appium driver install --source=local /path/to/your/driver ``` -------------------------------- ### Install Appium Driver using Appium Extension CLI Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 Installs a specific Appium driver using the Appium Extension CLI. This is a recommended method for managing drivers in Appium 2, allowing for modular installation. ```bash appium driver install uiautomator2 ``` -------------------------------- ### Install Appium Driver from NPM Source: https://appium.io/docs/en/3.1/developing/build-drivers Installs an Appium driver published on NPM. This command requires the package name of the driver on NPM. ```bash appium driver install --source=npm ``` -------------------------------- ### Install Appium 3 with npm Source: https://appium.io/docs/en/3.1/guides/migrating-2-to-3 This command installs the Appium 3 package globally using npm. It can be run on an existing Appium 2 installation to upgrade. An optional reset command is commented out. ```bash # optional: `appium setup reset` npm install -g appium ``` -------------------------------- ### List Appium Drivers and Plugins Source: https://appium.io/docs/en/3.1/reference/cli/extensions Lists all installed Appium extensions (drivers and plugins) and also shows official extensions that are not currently installed. Options allow filtering to only installed extensions or checking for available updates. ```bash appium {driver|plugin} list ``` ```bash appium driver list --installed --updates ``` -------------------------------- ### Example Gemfile for Appium Ruby Test Source: https://appium.io/docs/en/3.1/quickstart/test-rb An example of a Gemfile that includes the `appium_lib_core` and `test-unit` gems, essential for running Appium tests in Ruby. ```ruby source 'https://rubygems.org' gem 'appium_lib_core' gem 'test-unit' ``` -------------------------------- ### Appium Storage Plugin addStorageItem Request Example Source: https://appium.io/docs/en/3.1/reference/api/plugins This example demonstrates the structure of the response when adding a file to the Appium storage. It includes WebSocket paths for streaming and events, along with a timeout in milliseconds. ```json { "ws": { "stream": "/storage/add/ccc963411b2621335657963322890305ebe96186/stream", "events": "/storage/add/ccc963411b2621335657963322890305ebe96186/events" }, "ttlMs": 300000 } ``` -------------------------------- ### POST /session/:sessionId/appium/device/install_app Source: https://appium.io/docs/en/3.1/reference/api/appium Installs an application on the device under test. Requires the path to the app file (local or URL) and accepts optional driver-specific install options. ```APIDOC ## POST /session/:sessionId/appium/device/install_app ### Description Installs an app on the device under test. ### Method POST ### Endpoint /session/:sessionId/appium/device/install_app ### Parameters #### Request Body - **appPath** (string) - Required - Absolute local filepath or URL to an app file - **options** (unknown) - Optional - Driver-specific install options ### Response #### Success Response (200) `void` ``` -------------------------------- ### Appium Server Connection URLs Source: https://appium.io/docs/en/3.1/quickstart/install Example output from the Appium server indicating the URLs that client applications can use to connect. The primary URL for local connections is typically http://127.0.0.1:4723/. ```log [Appium] You can provide the following URLs in your client code to connect to this server: [Appium] http://127.0.0.1:4723/ (only accessible from the same host) (... any other URLs ...) ``` -------------------------------- ### Java Client Setup with Gradle Source: https://appium.io/docs/en/3.1/ecosystem/clients Instructions for setting up the Appium Java client using Gradle. This involves adding the `java-client` dependency to your `build.gradle` file. Replace `${version.you.require}` with the desired version. ```gradle dependencies { testImplementation 'io.appium:java-client:${version.you.require}' } ``` -------------------------------- ### Batch Install Appium Mobile Drivers Source: https://appium.io/docs/en/3.1/quickstart/uiauto2-driver Installs multiple Appium mobile-specific drivers simultaneously, including UiAutomator2, XCUITest (on macOS), and Espresso. This command can also be used to install drivers for desktop applications and browsers. ```bash appium setup ``` -------------------------------- ### Validate UiAutomator2 Driver Installation with Appium Doctor Source: https://appium.io/docs/en/3.1/quickstart/uiauto2-driver This command uses the Appium Doctor tool to check if all prerequisites for the UiAutomator2 driver are correctly configured. It helps identify any missing dependencies or setup issues. Successful validation means 0 required fixes are needed. ```bash appium driver doctor uiautomator2 ``` -------------------------------- ### Set up Appium .NET Project and Install Dependencies Source: https://appium.io/docs/en/3.1/quickstart/test-dotnet This snippet demonstrates how to create a new NUnit project for Appium testing and install the required Appium.WebDriver and Newtonsoft.Json packages using the .NET CLI. Ensure you are in the 'dotnet-client' directory before running these commands. ```.NET CLI cd dotnet-client dotnet new nunit --name appiumtest cd appiumtest # This will install the latest 5.x version dotnet add package Appium.WebDriver --prerelease dotnet add package Newtonsoft.Json --version 13.0.3 ``` -------------------------------- ### Appium Capabilities JSON with `appium:options` Source: https://appium.io/docs/en/3.1/guides/caps This example demonstrates a more organized structure for Appium capabilities using the `appium:options` capability. This groups various device and platform specific options under a single key, improving readability and management. ```json { "platformName": "iOS", "appium:options": { "platformVersion": "14.4", "deviceName": "iPhone 11", "app": "Some-App.app.zip", "automationName": "XCUITest" }, "$cloud:appiumOptions": { "version": "2.0.0", "automationVersion": "3.52.0", "plugins": ["images"] } } ``` -------------------------------- ### Appium Plugin Installation Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 In Appium 2, advanced features like image recognition and execute driver script are moved to plugins. These plugins must be installed separately using the Appium CLI. For example, 'images' and 'execute-driver' plugins. ```bash appium plugin install images appium plugin install execute-driver ``` -------------------------------- ### Java Client Setup with Maven Source: https://appium.io/docs/en/3.1/ecosystem/clients Instructions for setting up the Appium Java client using Maven. This requires adding the `java-client` dependency to your `pom.xml` file. Ensure you specify the correct version. ```xml io.appium java-client ${version.you.require} test ``` -------------------------------- ### .NET Client Installation Source: https://appium.io/docs/en/3.1/ecosystem/clients Install the Appium .NET client using the .NET CLI. This command adds the `Appium.WebDriver` NuGet package to your project, enabling you to write Appium tests in C#. ```bash dotnet add package Appium.WebDriver ``` -------------------------------- ### Initialize Node.js Project Source: https://appium.io/docs/en/3.1/quickstart/test-js Initializes a new Node.js project, creating a package.json file to manage dependencies. This is a prerequisite for installing client libraries. ```bash npm init ``` -------------------------------- ### Run Appium Extension Script Source: https://appium.io/docs/en/3.1/reference/cli/extensions Executes a specific script associated with an installed Appium driver or plugin. This is useful for setup tasks or other custom operations defined by the extension. Not all extensions provide runnable scripts. ```bash appium {driver|plugin} run [script-args] ``` ```bash appium driver run uiautomator2 reset ``` -------------------------------- ### Appium Server Launch with Plugins Source: https://appium.io/docs/en/3.1/guides/migrating-1-to-2 When launching the Appium 2 server, installed plugins can be activated using the '--use-plugins' flag followed by a comma-separated list of plugin names. This ensures the features provided by these plugins are available during the session. ```bash appium --use-plugins=images,execute-driver ``` -------------------------------- ### Verify Android Device Connection Source: https://appium.io/docs/en/3.1/quickstart/uiauto2-driver Verifies if the Android device or emulator is connected and recognized by the system. This command uses the ADB (Android Debug Bridge) binary, typically located in the platform-tools directory of the Android SDK. ```bash $ANDROID_HOME/platform-tools/adb devices ``` -------------------------------- ### Example Configuration File Schema Source: https://appium.io/docs/en/3.1/developing/config-system Illustrates how an extension's schema properties map to a configuration file structure. Properties are nested under 'server' with 'extension-type' and 'extension-name'. ```json { "server": { "driver": { "fake": { "foo": "bar" } } } } ``` -------------------------------- ### Initialize Appium Session Settings via Capabilities (Single) Source: https://appium.io/docs/en/3.1/guides/settings This example shows how to initialize a single Appium setting, such as 'ignoreUnimportantViews', when starting a new session. It uses a capability with the format 'appium:settings[]' and the desired value. This allows pre-configuring settings before the session begins. ```json { "appium:settings[ignoreUnimportantViews]": true } ``` -------------------------------- ### Install Linux Driver (Manual) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs a community-maintained driver for Linux applications. This requires cloning the repository, installing dependencies with yarn, and running the server manually. Note: This driver has not been maintained since 2022 and requires a custom Appium installation. ```bash git clone https://github.com/fantonglang/appium cd appium yarn install node ./ ``` -------------------------------- ### Install Roku Driver (NPM) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs the HeadSpin-maintained Appium driver for Roku channels (applications). This driver operates in 'Native' mode and is installed using npm. ```bash appium driver install --source=npm @headspinio/appium-roku-driver ``` -------------------------------- ### Update Appium Drivers and Plugins Source: https://appium.io/docs/en/3.1/reference/cli/extensions Updates one or more installed Appium extensions. This functionality is primarily supported for extensions installed via npm. By default, it updates only minor and patch versions to avoid breaking changes. It can update all installed extensions by specifying 'installed'. ```bash appium {driver|plugin} update ``` -------------------------------- ### Appium Extension Objects for Multiple Plugins Source: https://appium.io/docs/en/3.1/guides/caps This example shows how to specify multiple Appium plugins using extension objects within the `$cloud:appiumPlugins` capability. Each object defines the plugin's name, version, source, and package name, enabling version-specific plugin requests. ```json { "$cloud:appiumOptions": { "plugins": [{ "name": "images", "version": "1.1.0" }, { "name": "my-github-org/my-custom-plugin", "version": "a83f2e", "source": "github", "package": "custom-plugin" }] } } ``` -------------------------------- ### Install TizenTV Driver (NPM) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs the HeadSpin-maintained Appium driver for Tizen TV web applications. This driver operates in 'Web' mode and is installed using npm. ```bash appium driver install --source=npm appium-tizen-tv-driver ``` -------------------------------- ### Install Appium Flutter Driver (NPM) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs the community-maintained Appium driver for iOS and Android applications built with Flutter. It is installed via npm and supports 'Native' mode. ```bash appium driver install --source=npm appium-flutter-driver ``` -------------------------------- ### Install NovaWindows Driver (NPM) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs the community-maintained NovaWindows driver, recommended as a replacement for the partially unmaintained Windows driver. It targets native Windows applications and is installed via npm. ```bash appium driver install --source=npm appium-novawindows-driver ``` -------------------------------- ### Install Appium LG WebOS Driver (NPM) Source: https://appium.io/docs/en/3.1/ecosystem/drivers Installs the HeadSpin-maintained Appium driver for LG TV web applications. This driver operates in 'Web' mode and is installed using npm. ```bash appium driver install --source=npm appium-lg-webos-driver ``` -------------------------------- ### Appium Session Capabilities Source: https://appium.io/docs/en/3.1/guides/caps This section details the capabilities used to start an Appium session, including standard W3C WebDriver capabilities and Appium-specific extension capabilities. ```APIDOC ## Session Capabilities "Capabilities" are key-value pairs used to define the desired configuration for an Appium session. Values can be any valid JSON type. ### Standard W3C WebDriver Capabilities The W3C WebDriver specification defines a set of standard capabilities: | Capability Name | Type | Description | |--------------------|--------|----------------------------------------------| | `browserName` | string | The name of the browser to launch and automate | | `browserVersion` | string | The specific version of the browser | | `platformName` | string | The type of platform hosting the browser | ### Common Appium Capabilities Appium extends the standard capabilities with its own set, prefixed with `appium:`. | Capability Name | Type | Required? | Description | |-----------------------------------|---------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `platformName` | string | yes | The type of platform hosting the app or browser. | | `appium:automationName` | string | yes | The name of the Appium driver to use. | | `browserName` | string | no | The name of the browser to launch and automate, if the driver supports web browsers. | | `appium:app` | string | no | The path to an installable application. | | `appium:deviceName` | string | no | The name of a particular device to automate (e.g., `iPhone 14`). Primarily useful for iOS simulators; for other cases, `appium:udid` is recommended. | | `appium:platformVersion` | string | no | The version of the platform (e.g., for iOS, `16.0`). | | `appium:newCommandTimeout` | number | no | Seconds the Appium server waits for commands before timing out (default `60`). `0` disables the timer. | | `appium:noReset` | boolean | no | If true, avoids usual reset logic during session start and cleanup (default `false`). | | `appium:fullReset` | boolean | no | If true, performs additional reset steps for maximum environmental reproducibility (default `false`). | | `appium:eventTimings` | boolean | no | If true, collects Event Timings (default `false`). | | `appium:printPageSourceOnFindFailure` | boolean | no | If true, collects and prints page source on element find failure (default `false`). | **Note:** Individual drivers and plugins may support additional capabilities. Refer to their specific documentation. Some drivers may have group constraints on capabilities (e.g., XCUITest requires `appium:app`, `browserName`, or `appium:bundleId` to launch a specific app). ```