Setting Up and Configuring for Mobile App automationSetting Up and Configuring Mobile Emulator

Setting Up and Configuring Mobile Emulator

Install Appium, Android Studio, and Python, then configure a mobile emulator for testing.

Installation Steps for Appium

  1. Install Appium version 1.22.3 or the latest stable version.

  2. Download the Appium Desktop installer.

    Download the installer from this link: Appium Desktop Releases. Choose the appropriate file for Windows.

  3. Run the downloaded Appium installer.

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

  4. The Appium Setup dialog box appears. Click Install.

    Appium Setup dialog with Choose Installation Options and Install button
  5. Wait for the process to complete.

  6. 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
    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

Installation Steps for Python

  1. Download the stable Python version

    Download the Python stable version from Python Downloads.

  2. Run the .exe file and enable the "Add Python 3.7 to PATH" checkbox. By default, the path is set after installation. Select "Install Now".

    Python 3.7.3 Setup dialog with Install Now, Customize installation options and Add Python to PATH checkbox
  3. Wait for the process to complete and click Close.

  4. Install the Python packages by running the required commands in the command prompt.

    allure-behave         2.13.2
    allure-python-commons 2.13.2
    Appium-Python-Client  3.1.1
    async-generator       1.10
    atomicwrites          1.4.1
    attrs                 23.2.0
    beautifulsoup4        4.12.3
    behave                1.2.6
    certifi               2023.11.17
    cffi                  1.16.0
    charset-normalizer    3.3.2
    colorama              0.4.6
    cryptography          41.0.7
    h11                   0.14.0
    idna                  3.6
    imageio               2.33.1
    iniconfig             2.0.0
    lazy_loader           0.3
    MouseInfo             0.1.3
    networkx              3.2.1
    numpy                 1.26.3
    opencv-python         4.9.0.80
    outcome               1.3.0.post0
    packaging             23.2
    parse                 1.20.0
    parse-type            0.6.2
    pillow                10.2.0
    pip                   23.3.2
    pixelmatch            0.3.0
    pluggy                1.3.0
    py                    1.11.0
    pycparser             2.21
    pyOpenSSL             23.3.0
    pyparsing             3.1.1
    pyperclip             1.8.2
    PySocks               1.7.1
    pytest                7.4.4
    PyWavelets            1.5.0
    PyYAML                6.0.1
    requests              2.31.0
    scikit-image          0.22.0
    scipy                 1.11.4
    selenium              4.16.0
    setuptools            69.0.3
    six                   1.16.0
    sniffio               1.3.0
    sortedcontainers      2.4.0
    soupsieve             2.5
    tifffile              2023.12.9
    tomli                 2.0.1
    trio                  0.24.0
    trio-websocket        0.11.1
    urllib3               2.1.0
    wsproto               1.2.0
    xmltodict              0.13.0
    
  5. Open command prompt and type "pip install Package Name".

    For example, in the command prompt window, type 'pip install allure-behave'.

    Command prompt running pip install allure-behave with package download output

Initiating the Mobile Emulator

Perform the following to set Mobile Emulator Settings:

  1. Open Android Studio and select the "Configure" option.
  2. Select AVD Manager from the dropdown list as shown:
    Android Studio welcome screen with Configure menu open and AVD Manager option highlighted
  3. After opening AVD manager, click the "Create Virtual Device" button.
    Android Virtual Device Manager with Create Virtual Device button highlighted
  4. Select the appropriate Pixel version (Pixel 3 or 4 is recommended), ensuring it has the Play Store, and click "Next."
    Virtual Device Configuration Select Hardware screen with Pixel 2 selected and Next button highlighted
  5. Now, download the appropriate version.
  6. Click "Next".
    Virtual Device Configuration System Image screen with Oreo API 26 selected and Next button
  7. Click Finish.
    Virtual Device Configuration Verify Configuration screen with AVD Name field and Finish button
  8. After creating the emulator, click the play button to start the emulator.

Configure 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 and add the following data for the mobile app.

      "platformName": "Android",
      "automationName": "Appium",
      "deviceName": "your_device_name",
      "app": "path/to/your/app.apk",
      "appPackage": "your.app.package",
      "appActivity": "your.app.activity"
    
  5. After saving the Appium desired capabilities, click "Start Session" to initiate the session.

    Appium Desired Capabilities screen with platformName, deviceName, platformVersion and browserName fields
  6. Verify that your emulator is running correctly.

    1. Open a command prompt.
    2. Run the following command to verify that the emulator is recognized:
      adb devices