Command-line interface for server management, extension administration, and environment setup.
Appium provides a comprehensive command-line interface for server management, extension administration, and environment setup. The CLI parsing functions are internal to Appium and used during CLI execution.
Start and manage the Appium server with various configuration options.
CLI Usage:
# Start server with default settings
appium server
# Start server with custom port and address
appium server --port 4725 --address 0.0.0.0
# Start server with CORS enabled
appium server --allow-cors
# Start server with debug logging
appium server --log-level debug
# Start server with specific drivers and plugins
appium server --use-drivers uiautomator2,xcuitest --use-plugins images
# Show current configuration
appium server --show-config
# Show build information
appium server --show-build-info
# Show debug information
appium server --show-debug-infoManage driver extensions through the CLI.
CLI Usage:
# List installed drivers
appium driver list
# List available drivers
appium driver list --installed
# Install a driver
appium driver install uiautomator2
# Install driver from npm package
appium driver install --source npm appium-xcuitest-driver
# Install driver from Git
appium driver install --source git https://github.com/appium/my-driver.git
# Install driver from local path
appium driver install --source local /path/to/driver
# Uninstall a driver
appium driver uninstall uiautomator2
# Update a driver
appium driver update uiautomator2
# Update all drivers
appium driver update
# Run driver doctor checks
appium driver doctor uiautomator2
# Run driver scripts
appium driver run uiautomator2 script-nameManage plugin extensions through the CLI.
CLI Usage:
# List installed plugins
appium plugin list
# List available plugins
appium plugin list --installed
# Install a plugin
appium plugin install images
# Install plugin from npm package
appium plugin install --source npm @appium/execute-driver-plugin
# Install plugin from Git
appium plugin install --source git https://github.com/appium/my-plugin.git
# Install plugin from local path
appium plugin install --source local /path/to/plugin
# Uninstall a plugin
appium plugin uninstall images
# Update a plugin
appium plugin update images
# Update all plugins
appium plugin update
# Run plugin doctor checks
appium plugin doctor images
# Run plugin scripts
appium plugin run images script-nameSet up development environments for different platforms.
CLI Usage:
# Set up mobile development environment
appium setup mobile
# Set up desktop development environment
appium setup desktop
# Set up browser testing environment
appium setup browser
# Reset Appium environment
appium setup reset
# Interactive setup wizard
appium setupThe CLI interface includes various internal utility functions for parsing and validating command-line arguments. These functions are used internally by Appium and are not part of the public API. For programmatic use, prefer using the main() and init() functions from the main API.
// Main command types
const SERVER_SUBCOMMAND = "server";
const SETUP_SUBCOMMAND = "setup";
const DRIVER_TYPE = "driver";
const PLUGIN_TYPE = "plugin";
// Extension subcommands
const EXT_SUBCOMMAND_LIST = "list";
const EXT_SUBCOMMAND_INSTALL = "install";
const EXT_SUBCOMMAND_UNINSTALL = "uninstall";
const EXT_SUBCOMMAND_UPDATE = "update";
const EXT_SUBCOMMAND_RUN = "run";
const EXT_SUBCOMMAND_DOCTOR = "doctor";
// Setup subcommands
const SUBCOMMAND_MOBILE = "mobile";
const SUBCOMMAND_DESKTOP = "desktop";
const SUBCOMMAND_BROWSER = "browser";
const SUBCOMMAND_RESET = "reset";interface ArgumentParser {
add_argument(name: string, options: ArgumentOptions): void;
add_subparsers(options: SubparserOptions): SubParsers;
parse_args(args?: string[]): ParsedArgs;
}
interface ArgumentOptions {
action?: string;
version?: string;
dest?: string;
help?: string;
type?: string | Function;
choices?: any[];
default?: any;
required?: boolean;
nargs?: string | number;
}
interface SubparserOptions {
dest: string;
help?: string;
}
interface SubParsers {
add_parser(name: string, options?: ParserOptions): ArgumentParser;
}
interface ParserOptions {
help?: string;
description?: string;
parents?: ArgumentParser[];
}
interface ServerArgs {
port: ArgSpec;
address: ArgSpec;
basePath: ArgSpec;
allowCors: ArgSpec;
logLevel: ArgSpec;
[key: string]: ArgSpec;
}
interface CliCommand {
subcommand: string;
}
interface ServerCommand extends CliCommand {
subcommand: "server";
}
interface DriverCommand extends CliCommand {
subcommand: "driver";
driver: DriverSubcommand;
}
interface PluginCommand extends CliCommand {
subcommand: "plugin";
plugin: PluginSubcommand;
}
interface SetupCommand extends CliCommand {
subcommand: "setup";
setup?: SetupSubcommand;
}
interface DriverSubcommand {
subcommand: "list" | "install" | "uninstall" | "update" | "run" | "doctor";
driver?: string;
source?: "npm" | "git" | "github" | "local";
package?: string;
installType?: string;
}
interface PluginSubcommand {
subcommand: "list" | "install" | "uninstall" | "update" | "run" | "doctor";
plugin?: string;
source?: "npm" | "git" | "github" | "local";
package?: string;
installType?: string;
}
interface SetupSubcommand {
subcommand?: "mobile" | "desktop" | "browser" | "reset";
}