Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Appium is an open-source tool for automating mobile, web, and hybrid applications on iOS, Android, and Windows platforms. It allows you to write tests using the WebDriver protocol and supports multiple programming languages such as Java, JavaScript, Python, and more.
Automate Mobile Applications
This code demonstrates how to automate an Android mobile application using Appium. It initializes a WebDriver client with the necessary capabilities and performs a click action on an element identified by its accessibility ID.
const wdio = require('webdriverio');
const opts = {
port: 4723,
capabilities: {
platformName: 'Android',
platformVersion: '9',
deviceName: 'emulator-5554',
app: '/path/to/the/app.apk',
automationName: 'UiAutomator2'
}
};
(async () => {
const client = await wdio.remote(opts);
await client.init();
await client.elementByAccessibilityId('SomeElement').click();
await client.quit();
})();
Automate Web Applications on Mobile Browsers
This code demonstrates how to automate a web application on a mobile browser using Appium. It initializes a WebDriver client with the necessary capabilities for a Chrome browser on an Android emulator, navigates to a URL, and retrieves the page title.
const wdio = require('webdriverio');
const opts = {
port: 4723,
capabilities: {
platformName: 'Android',
platformVersion: '9',
deviceName: 'emulator-5554',
browserName: 'Chrome',
automationName: 'UiAutomator2'
}
};
(async () => {
const client = await wdio.remote(opts);
await client.url('http://example.com');
const title = await client.getTitle();
console.log('Title:', title);
await client.quit();
})();
Automate Hybrid Applications
This code demonstrates how to automate a hybrid application using Appium. It initializes a WebDriver client with the necessary capabilities for an iOS device, switches to the webview context, navigates to a URL, and retrieves the page title.
const wdio = require('webdriverio');
const opts = {
port: 4723,
capabilities: {
platformName: 'iOS',
platformVersion: '13.3',
deviceName: 'iPhone 11',
app: '/path/to/the/app.app',
automationName: 'XCUITest'
}
};
(async () => {
const client = await wdio.remote(opts);
await client.init();
await client.context('WEBVIEW_1');
await client.url('http://example.com');
const title = await client.getTitle();
console.log('Title:', title);
await client.quit();
})();
Selenium WebDriver is a popular tool for automating web applications across different browsers. Unlike Appium, which is designed for mobile applications, Selenium WebDriver is primarily focused on web automation. It supports multiple programming languages and is widely used for browser-based testing.
Detox is an end-to-end testing library for mobile applications, specifically designed for React Native apps. It provides fast and reliable testing by running tests directly on the device or emulator. Unlike Appium, which supports multiple platforms and languages, Detox is tailored for React Native and JavaScript.
Calabash is an open-source framework for automated acceptance testing of mobile apps. It supports both Android and iOS platforms and allows you to write tests in Cucumber, a behavior-driven development (BDD) tool. Compared to Appium, Calabash is more focused on BDD and uses a different approach for writing tests.
Cross-platform test automation for native, hybrid, mobile web and desktop apps.
Documentation | Get Started | Ecosystem | Changelog | Contributing Guide | Discussion Forum
Appium is an open-source automation framework that provides WebDriver-based automation possibilities for a wide range of different mobile, desktop and IoT platforms. Appium is modular and extensible, and supports multiple programming languages, which means there is an entire ecosystem of related software:
As of January 1st, 2022, the Appium team no longer maintains or supports Appium 1. All officially supported platform drivers are only compatible with Appium 2.
Please read the Migration Guide if you are still using Appium 1.
[!WARNING] If you use Appium Desktop or Appium Server GUI, you will not be able to upgrade to Appium 2, as both of these tools have been deprecated. Please use Appium Inspector in combination with a standalone Appium 2 server.
Appium can be installed using npm
(other package managers are not currently supported). Please
check the installation docs for the
system requirements and further information.
If upgrading from Appium 1, make sure Appium 1 is fully uninstalled (npm uninstall -g appium
).
Unexpected errors might appear if this has not been done.
npm i -g appium
Note that this will only install the core Appium server, which cannot automate anything on its own. Please install drivers for your target platforms in order to automate them.
Appium supports app automation across a variety of platforms, like iOS, Android, macOS, Windows, and more. Each platform is supported by one or more "drivers", which know how to automate that particular platform. You can find a full list of officially-supported and third-party drivers in Appium Ecosystem's Drivers page.
Driver management is done using Appium's Extension command-line interface:
# Install an official driver from npm (see documentation for a list of such drivers)
appium driver install <driver-name>
# Install any driver from npm
appium driver install --source=npm <driver-name>
# See documentation for installation from other sources
# List already installed drivers
appium driver list --installed
# Update a driver (it must be already installed)
# This will NOT update the major version, in order to prevent breaking changes
appium driver update <driver-name>
# Update a driver to the most recent version (may include breaking changes)
appium driver update <driver-name> --unsafe
# Uninstall a driver (it won't last forever, will it?)
appium driver uninstall <driver-name>
Client libraries enable writing Appium tests in different programming languages. There are officially-supported clients for Java, Python, Ruby, and .NET C#, as well as third-party clients for other languages. You can find a full list of clients in Appium Ecosystem's Clients page.
Plugins allow you to extend server functionality without changing the server code. The main difference between drivers and plugins is that the latter must be explicitly enabled on Appium server startup (all installed drivers are enabled by default):
appium --use-plugins=<plugin-name>
You can find a full list of officially-supported and third-party plugins in Appium Ecosystem's Plugins page.
Similarly to drivers, plugin management is also done using Appium's Extension command-line interface:
# Install an official plugin from npm (see documentation for a list of such plugins)
appium plugin install <plugin-name>
# Install any plugin from npm
appium plugin install --source=npm <plugin-name>
# See documentation for installation from other sources
# List already installed plugins
appium plugin list --installed
# Update a plugin (it must be already installed)
# This will NOT update the major version, in order to prevent breaking changes
appium plugin update <plugin-name>
# Update a plugin to the most recent version (may include breaking changes)
appium plugin update <plugin-name> --unsafe
# Uninstall a plugin
appium plugin uninstall <plugin-name>
In order to start sending commands to the Appium server, it must be running on the URL and port where your client library expects it to listen. Appium's command-line interface is used to launch and configure the server:
# Start the server on the default host (0.0.0.0) and port (4723)
appium server
# You can also omit the 'server' subcommand
appium
# Start the server on the given host, port and use a custom base path prefix (the default prefix is '/')
appium --address 127.0.0.1 --port 9000 --base-path /wd/hub
Appium supports execution of parallel server processes, as well as parallel driver sessions within a single server process. Refer the corresponding driver documentations regarding which mode is optimal for the particular driver or whether it supports parallel sessions.
xcuitest
and uiautomator2
have built-in mobile web and hybrid app support.
Within the same script, you can switch seamlessly between native app automation and webview
automation, all using the WebDriver model that's already the standard for web automation.Investing in the WebDriver protocol means you are betting on a single, free, and open protocol for testing that has become a web standard. Don't lock yourself into a proprietary stack.
For example, if you use Apple's XCUITest library without Appium, you can only write tests using Obj-C/Swift, and you can only run tests through Xcode. Similarly, with Google's UiAutomator or Espresso, you can only write tests in Java/Kotlin. Appium opens up the possibility of true cross-platform native app automation, for mobile and beyond!
If you are looking for a more comprehensive description of what this is all about, please read our documentation on How Does Appium Work?.
Appium has a Sponsorship Program! If you or your company uses Appium and wants to give back financially to the project, we use these funds to encourage development and contributions, as well as support other open source projects we rely on. Become a sponsor via our OpenCollective page.
Appium is incredibly grateful to our Development and Strategic Partners for their sustained contribution of project development and leadership!
A full list of sponsors is available at our Sponsors page.
@appium/logger
package is under ISC License.
FAQs
Automation for Apps.
The npm package appium receives a total of 231,478 weekly downloads. As such, appium popularity was classified as popular.
We found that appium demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.