乐闻世界logo
搜索文章和话题

How to setup Appium in Ubuntu for android

1个答案

1

The setup process involves several steps, including installing necessary software, configuring the environment, and verifying the installation. Below, I will explain each step in detail:

Step 1: Install Java

Appium depends on Java, so first ensure that Java is correctly installed. You can install Java using the following command:

bash
sudo apt update sudo apt install openjdk-11-jdk

After installation, verify that Java is installed successfully by running java -version.

Step 2: Install Node.js and npm

Appium is a Node.js application, so you need to install Node.js and npm. You can install them using the following command:

bash
sudo apt install nodejs sudo apt install npm

Similarly, you can verify the installation of these components by running node -v and npm -v.

Step 3: Install Appium

Appium can be installed via npm:

bash
npm install -g appium

After installation, check the Appium version by running appium -v to ensure it is correctly installed.

Step 4: Install Android SDK

Appium requires the Android SDK for automating Android application testing. You can download Android Studio from Android Developer Website, which also installs the Android SDK.

After installation, you need to set environment variables. Add the following lines to ~/.bashrc or ~/.profile file:

bash
export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools

After making changes, use source ~/.bashrc or source ~/.profile to apply the changes.

Step 5: Install Appium Doctor

To verify that all dependencies are correctly installed and configured, you can install Appium Doctor:

bash
npm install -g appium-doctor

After installation, run appium-doctor, which checks and reports any missing configurations or dependencies.

Step 6: Run Appium

Once everything is ready, you can start the Appium server:

bash
appium

This will start the Appium server and wait for connection to your test scripts.

Summary

By following these steps, you can successfully set up the Appium environment on Ubuntu for Android testing. This includes installing Java, Node.js, npm, Appium itself, and the Android SDK, and ensuring all environment variables are set correctly. Finally, running Appium Doctor to verify the environment is a good practice.

2024年7月20日 03:13 回复

你的答案