Pre-requisites for Mobile App Test AutomationInstallation Steps for Java Appium

Installation Steps for Java Appium

Install the JDK and Appium for Java-based mobile app automation.

Overview of Java Development Kit Installation

Java Programming and Android Programming use the Java Development Kit (JDK) software. This software is a free download specifically created for programming Java applications. This article guides you through the download and installation procedure for setting up the JDK on your computer.

To develop or run Java applications, download and install JDK.

For Windows, perform the following actions:

  1. Download the latest JDK installer

    Download the latest JDK.exe installer here.

    In this case, Java 21.0.1 version is used.

  2. Select Yes to verify control access.

  3. Welcome to the Installation Wizard window appears and Click Next.

    Java SE Development Kit 21.0.1 Setup wizard welcome screen with Next and Cancel buttons
  4. Optionally, click the Change button if you wish to modify the installation folder path.

    Otherwise, click Next to proceed with copying the files into the specified folder.

    Java SE Development Kit 21 setup Destination Folder screen with Next button
  5. Upon successful installation, the JDK Successfully Installed message is displayed.

    Click Close.

    Java SE Development Kit 21.0.1 installation complete dialog with Next Steps and Close buttons
  6. To verify Java Version, perform the following:

    1. Open a command prompt and run the following command to verify the installation and check the version of Java.

      java -version
      
    2. This command will display the installed Java version.

      If the JDK is properly installed and configured, you will see the following information about the Java version, as shown:

      Command prompt showing java -version output with Java 1.8.0_401 details
  7. To add Java Home to the environment variables, perform the following:

    1. Right-click the Start button and select System.

      Windows taskbar Start button with cursor over it, dimmed knowledge base article in background
    2. Click the Advanced system settings link in the right pane.

      Related settings list with Advanced system settings link highlighted
    3. In the System properties window, select the Environment Variables button.

      System Properties dialog Advanced tab with Environment Variables button highlighted
    4. Select the Java Home Path.

    5. Click Edit.

    6. To ensure that JAVA_HOME is set correctly, check its value.

      The path will be updated based on your installation directory. For example, if Java is installed on the D drive, the path may differ from the default location as shown in the screenshot:

      Edit System Variable dialog setting JAVA_HOME with OK button highlighted
    7. Click OK.

    8. Similarly, you need to update Path as shown in the secondary screenshot.

      Select the Path and click Edit.

      Environment Variables dialog with system Path variable row and Edit button highlighted
    9. The following screen is displayed with Path as C:\Program Files(x86)\Common Files\Oracle\Java\javapath.

      Edit environment variable dialog with Path entries highlighted and New, Edit, Browse, Delete buttons
    10. Click OK and then OK again.

Installation steps for Appium

Install Appium version 1.22.3 or the latest stable version.

Ensure you install a compatible version of Appium for your Java-based mobile automation setup.

Download the Appium Desktop installer

Download the installer from this link: Appium Desktop Releases.

Choose the appropriate file for Windows.

Run the downloaded Appium installer

Click on the downloaded file, "Appium-Server-GUI-windows-1.22.3-4.exe."

The Appium Setup dialog box appears, click 'Install'.

Appium Setup dialog with Choose Installation Options and Install button

Wait for the process to complete.

The installation progress bar indicates when the setup is complete.

After completing the process, click 'Finish'.

Appium Setup wizard Completing Appium Setup screen with Run Appium checked and Finish button

Installation steps for Android Studio

  1. Download the installer from this link: Android Studio.
  2. Select "I agree with the terms." Choose the file named "android-studio-ide-202.7486908-windows.exe"."
  3. Click the downloaded file, "android-studio-ide-202.7486908-windows.exe."
  4. Android Studio Setup window appears. Click Next.
    Welcome to Android Studio Setup screen with Next button
  5. Choose the Android Virtual Device option and click Next.
    Android Studio Setup Choose Components screen with Android Studio and Android Virtual Device checked
  6. Click Next.
    Android Studio Setup Install Locations screen with installation path field and Next button
  7. Click "Install".
    Android Studio Setup Choose Start Menu Folder screen with Install button
  8. Wait for the process to complete and click Next.
    Android Studio Setup Installation Complete screen with Next button
  9. Click "Finish".
    Android Studio Setup: Completing Android Studio Setup screen with Start Android Studio checkbox and Finish button

Adding Android Home to Environment Variables

The Appium server needs to know where the Android SDK and other tools such as Platform Tools are located to run tests successfully.

To set the path for Android Studio in system variables under environment variables, perform the following:

Note: Make sure that a Java-compatible version is installed. To download the compatible version, refer to Java Downloads.

  • ANDROID_HOME -> C:\Users\DELL\AppData\Local\Android\Sdk
  • JAVA_HOME -> C:\Program Files\Java\jdk1.8.0_201
  • Update the following paths:
    • C:\Users\DELL\AppData\Local\Android\Sdk\platform-tools\
    • C:\Users\DELL\AppData\Local\Android\Sdk\tools\
    • C:\Users\DELL\AppData\Local\Android\Sdk

Initiating the Tablet and Appium

Perform the following to set Tablet Settings:

Open Android Studio and select the 'Configure' option.

On the Android Studio welcome screen, click the Configure dropdown.

Select AVD Manager from the dropdown list.

Android Studio welcome screen with Configure menu open and AVD Manager option highlighted

After opening AVD manager, click the 'Create Virtual Device' button.

Android Virtual Device Manager with Create Virtual Device button highlighted

Select an Android device (in this case, a tablet) from the Select Hardware and Select Image pop-up windows.

Choose the hardware profile and system image that match your testing requirements.

Select the appropriate Pixel version as shown in the following screenshot and update the required settings as follows, ensuring it has the Play Store, and click 'Next.'

Device Manager list with Pixel Tablet API 30 highlighted and Device Info summary panel

Enter a name for the AVD as shown in the sample screenshot:

AVD Verify Configuration screen with AVD Name field set to Automation and Finish button

Click Finish.

The virtual device is now created and appears in the AVD Manager list.

Click the play button in the Actions column to start the tablet.

The emulator launches and the tablet home screen appears.

Set the Appium Settings

Perform the following:

  1. Open Appium desktop app and click the 'Start Server v1.13.0' button.

    Appium desktop app with Host and Port fields and Start Server v1.13.0 button
  2. From the File menu, select 'New Session Window'.

    Appium File menu with New Session Window option highlighted
  3. Download and Install Appium Inspector

    To download and install the latest version of the file, click Appium-Inspector-windows-2023.12.2-x64.exe.

  4. In the Appium Inspector, set the desired capabilities, add the following data for the tablet.

    JSON desired capabilities code block with platformName, appium:deviceName and appPackage values
  5. After saving the Appium desired capabilities, click 'Start Session' to initiate the session.

    Appium Desired Capabilities tab listing platformName, automationName and JSON representation panel
  6. Verify that your tablet is running correctly.

    1. Open a command prompt.
    2. Run the following command to verify that the tablet is recognized:
      adb devices -l
      
      Command Prompt with adb devices -l command entered