Table Of Contents
1. Introduction:
2. prerequisites:
- Installed JDK
- NodeJs
3. Download and run Appium:
chmod a+x
./AppImageYou can see as the Appium Ui started similar to this.
Now, start the Appium server with default port 4723 by clicking the "Start Server" button.
4. Setup Android Emulator:
tar -xvf android-studio.tar.gz
Click "Next" and "Finish" which will download the SDK on the SDK folder mentioned.
Now, we need to configure the android virtual device for this click "Configure" and select "AVD Manager".
If you see "dev/kvm device: permission denied" you can give permission for the user by using the command:
sudo chown yourLinuxUser /dev/kvmCreate a Virtual Device
After that, select the downloaded image and click "Next" and verify android virtual device configuration and click "Finish" to finish the virtual device setup. Now you can launch the virtual device in the Emulator.
Now, let's configure the SDK path in our system. For this open bashrc file by using the command:
sudo gedit ~/.bashrc
export ANDROID_HOME=/home/kchapagain/Downloads/Sdk export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$PATH export PATH=$PATH:$ANDROID_HOME/platform-toolsMake sure you provided the correct download SDK path in "ANDROID_HOME" in my case it's "/home/kchapagain/Downloads/Sdk". Save the file and reload the changes by using the command:
source ~/.bashrc
emulator -list-avdsOutput:
Pixel_2_API_28 Pixel_2_API_28_2
Now, run the device on the Emulator using command:
emulator -avd Pixel_2_API_28User your device name instead "Pixel_2_API_28". It will run the android virtual device on Emulator.
Create a java project and create a package called "libs" under "src". Copy all the downloaded jar file in this package and load the jar file from Ide.
Go to: File >> Project Structure(Ctr + Alt + Shift + s) >> Libraries and click the + icon on the top left corner and select package.
6. Setup driver config for Appium:
@Before public static void setUp() throws MalformedURLException { DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability("platformName", "Android"); cap.setCapability("deviceName", "50b6ab0"); cap.setCapability("appPackage", ""); cap.setCapability("appActivity", ""); cap.setCapability("automationName", "UiAutomator1"); cap.setCapability("autoGrantPermissions", true); cap.setCapability("autoAcceptAlerts", "true"); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap); }