When it comes to mobile app testing, flexibility and efficiency are critical. With the help of the well-known open-source automation technology Appium, testers may automate mobile apps on several platforms. Appium's command line interface (CLI), which lets testers use the terminal or command prompt to interact with Appium, is one of its most potent features. We will examine the features of Appium's CLI and how you can use it to automate your mobile testing process in this post.
Appium - Command Line
With the Appium CLI (Command-Line Interface) tool, you can communicate with the Appium server and conduct automated tests for mobile apps right from the command line. Without requiring a graphical user interface, you may use the Appium CLI to start the Appium server, install and run apps on mobile devices or emulators, and run test scripts.
Appium CLI Features
- Server Management: You can use the command line to start, stop, and restart the Appium server. Give details about the host, port, and logging level of the server.
- Device Administration: For testing, connect to real devices or emulators. Install, open, and remove applications from emulators or linked devices.
- Automated Testing: Run test scripts directly in a variety of programming languages (such as Java, Python, and JavaScript)
Getting Started with Appium CLI
Before diving into the intricacies of Appium's CLI, it's essential to ensure that you have Appium installed on your system. You can install Appium using npm (Node Package Manager) by running the following command: The first step is check whether the Node.js is installed on your system or not .
To check, open the terminal and run the following command:
node --version

If Node.js is installed in your system then it will reutrn the version of node.js, otherwise it will throw an error 'error is not recognised'. To download Node.js, visit the official https://nodejs.org/en/download

Choose the node installer according to your system. Window users need to check the bit size before downloading. Once download is finished , run and proceed with the installation. Now restart the terminal and check for the version again by running the command -> node --version. It will return the node version. Mac users can use node -v and npm -v commands to verify the installation and the version details.
To install Appium, run the command given below:
npm install -g appium

Once Appium is installed, you can start the Appium server by simply typing appium in your terminal or command prompt.
Starting the Appium Server
With the help of this command, you can connect to your mobile devices for automation by starting the Appium server.
appium

Install Plugins
For install the plugins use the below commands.
appium plugin install relaxed-caps

Start Appium Server with Custom Options
appium --port 4723 --log-level debug

Advanced Usage
This command starts the Appium server and records debug-level logs into the specified file "/path/to/logfile.tx
appium --log /path/to/logfile.txt --log-level debug

If you're automating web apps on Android, this command sets the path of the ChromeDriver executable. here's a some of the commonly used Appium command line options
Command | Description |
---|
appium | Start the Appium server |
---|
appium -p <port> | Specify the port on which Appium should listen |
---|
appium -a <address> | Specify the IP address to which Appium should bind |
---|
appium -bp <bootstrapPort> | Specify the bootstrap port for communication with Appium |
---|
appium -U <udid> | Specify the device UDID to connect to |
---|
appium --no-reset | Do not reset app state between sessions |
---|
appium --session-override | Override existing sessions during server startup |
---|
appium --log <file> | Redirect server output to a file |
---|
appium --log-timestamp | Add timestamps to server log output |
---|
appium --local-timezone | Use local timezone for timestamps in logs |
---|
appium --log-level <level> | Specify log level (debug, info, warn, error, silent) |
---|
appium --default-capabilities <json> | Specify default capabilities as a JSON object |
---|
appium --command-timeout <timeout> | Specify the command timeout in milliseconds |
---|
appium --relaxed-security | Enable relaxed security mode (allowing unsigned apps) |
---|
Similar Reads
Command Line Arguments in C++
Command-line arguments are arguments that are passed to a program when it is executed from the command line or terminal. They are provided in the command-line shell of operating systems with the program execution command.The main function of C++ generally has the following signature:C++int main(){ /
3 min read
npm bin Command
The npm bin command is a lesser-known but incredibly useful command in the Node.js ecosystem. It provides information about the location where npm installs globally executable binaries or locally installed binaries for the current project. In this article, weâll explore the details of the npm bin co
4 min read
Command Line Argument in Scala
The arguments which are passed by the user or programmer to the main() method are termed as Command-Line Arguments. main() method is the entry point of execution of a program. main() method accepts an array of strings. runtime. But it never accepts parameters from any other method in the program. Sy
2 min read
Command Line Arguments in Golang
Command-line arguments are a way to provide the parameters or arguments to the main function of a program. Similarly, In Go, we use this technique to pass the arguments at the run time of a program. In Golang, we have a package called as os package that contains an array called as "Args". Args is an
2 min read
CLI Commands in NPM
NPM, short for Node Package Manager, is the default package manager for NodeJS. It is a command-line utility that allows you to install, manage, and share packages or modules of JavaScript code. These packages can range from small utility libraries to large frameworks, and they can be easily integra
4 min read
npm bugs Command
When working with npm packages, you might encounter bugs or issues with a package, and finding the appropriate place to report or view existing bugs can be crucial. In this article, we will explore how to use the npm bugs command and its configuration options.What is the npm bugs Command?The npm bug
5 min read
Appium Server Download
Appium is a well-known open-source test automation software developed to carry out UI automation for Mobile Apps, Desktop Apps, browsers, TVs, etc. It is developed and maintained by Sauce Labs to automate the process of native and hybrid mobile applications. Appium can also run multiple test cases o
3 min read
Gem Command Basics in Ruby
RubyGems is a package management framework for Ruby that simplifies the process of distributing, installing, and managing Ruby libraries. The gem command-line tool is the primary interface for interacting with this framework. The gem command is a fundamental tool in Ruby for managing RubyGems, which
7 min read
Command Line Arguments in Objective-C
In Objective-C, command-line arguments are strings of text that are passed to a command-line program when it is launched. They can be used to specify options or parameters that control the behavior of the program or to provide input data that the program can process. To access command-line arguments
2 min read
apm Command in Linux With Examples
apm is the abbreviation for Atom Package Manager. It is used to install and manage Atom Packages. This command uses NPM (Node Package Manager) internally and spawns npm processes to install Atom packages. This command requires the Advanced Power Management subsystem. If run without arguments it read
2 min read