Mobile Testing – SoliteraTA

SoliteraTA

Mobile Testing

System Configuration #

  1. Installation of java (JDK) – 
    1. Download and install the JDK 1.8 from – Java Downloads | Oracle
    2. Specify the path to your JDK version in the JAVA_HOME environment variable. To do this, open the Control Panel, search for “environment variables”, in the subsequent dialog, click Environment Variables, and then set the variable value:
      • JAVA_HOME       C:\Program Files\Java\jdk1.8.0_341
  1. Install Nodejs and NPM fromDownload | Node.js (nodejs.org)
  2. Install Appium – 
    1. Run the below command on Command Prompt
      1. npm -g install appium@x.y.z
  3. Install Android Studio from the below link

Android Studio download archives  |  Android Developers

*Remarks –

  1. Please accept the terms and condition of Android Studio and download the below pack

Android Studio Electric Eel | 2022.1.1 Patch 1 January 31, 2023

  1. After Installation Android Studio, Install Android SDK from Configure > SDK Manager and set the path to ‘environments variables’ > ‘System Variables’ as below
    1. ANDROID_HOME –    C:\Users\<User-Name> \AppData\Local\Android\Sdk
      1. <User-Name> – Please replace this word as per your user’s name 
    2. Note – Please check the ANDROID_HOME is updated or not by Command prompt, the Command is below –
      1. echo %ANDROID_HOME% 

Check If you find the same path as given in environments variable then path is set, otherwise you have to re-start you PC.

  1. Add some path into your environment’s variables –
    1. User Variables for <User_Name>
      1. Click on path, add new path and paste it   %USERPROFILE%\AppData\Local\Android\sdk\platform-tools
    2. System Variable 
      • Click on path, add new path and paste it  
        C:\Program Files\Android\Android Studio\bin
  2. Setup the appium drivers:
    •  run the command to install the driver:
      • “appium driver install uiautomator2”
    • Run command to check installed driver:
      • “appium driver list”

Note- Check after running the above command “appium driver list”, If you see this uiautomator2 version then you have successfully installed the driver for execution:

” √ Listing available drivers – uiautomator2@x.y.z [installed (npm)]”

If uiautomator2 is not installed, then run this command to install the uiautomator2

 “appium driver install uiautomator2”

Mobile Phone Configuration #

  1. Open Developer Mode – 
    • Go to your mobile phone setting
    • Click on About phone 
    • Tap 5 times on Build Version until the Developer mode enabled
  2. Enable USB Debugging and others –
    • Go to Developer mode settings
    • Enable USB Debugging
    • Enable Install via USB [enable if exists]
    • Enable USB Debugging (Security settings) [enable if exists]
  3. Connect to USB and check if it is connected with ADB
    • Connect to USB and allow File Transfer/ Android Auto
    • And run command – adb devices

Note:-

  1.  Above id of the device is used as UDID to connect with the same device.
  2.  If adb devices do not appear in the command prompt, please recheck if all the environment variable paths are correctly created or not , if all the paths are correctly created then please restart your system and check the command again.

How to find App_package_name and App_main_activity_name ?

Please connect your device to USB and open the app to find the activity and package name. After doing this, please run a command in Command Prompt.

For Mac/Linux:

adb shell dumpsys window | grep -E 'mCurrentFocus'

For Windows:

adb shell dumpsys window | find "mCurrentFocus"

How to get UDID ?

 Run “adb devices” command in command prompt.

 While installing Android studio, which version should be chosen, like standard or custom ?

 We can choose any of them but preferences is for standard

Which SDK tools are mandatory to install in Android Studio for automating scripts using SoliteraTA tool ?

 These must be installed-

  • Android SDK Build-tools
  • Android SDK Platform-Tools
  • Intel x86 Emulator Accelerator (HAXM installer)

How to Find Elements for Mobile Automation?

To find Elements, perform the below steps -:

1- Download & install the below tools -:

2- Connect your device/Emulator

3- Open Appium Desktop Sever

  • Go to the advanced tab
  • Here, remove the server address and check the checkbox name Allow CORS
  • Start the server, after starting the server started look like the below screen shot.

4- Open the Appium Inspector

  • Fill the all field as in the above screenshot –
  1. Remote Host – localhost
  2. Remote Port – by default 4723
  3. Remote Path – /wd/hub
  • Add Capabilities -: Under the Desired Capabilities add the below fields
NameTypeValue
platformNametextAndroid/ios
udidtextReal / emulator device udid
deviceNametextName of the device
automationNametextIf Android write
‘UiAutomator2’, if IOS write
‘XCUITest’
Note – To avoid the repetition to add capabilities, save the capabilities once

OR

Json Format
{
  "appium:platformName": "Android",
  "appium:udid": "emulator-5554",
  "appium:deviceName": "Pixel_3a",
  "appium:automationName": "UiAutomator2"
}
  • Open the app, for which you have to create elements
  • Now start the session by clicking on Start Session button.
  • Once the session started, the Appium Inspector window will open, showing the screen of your connected mobile
  • Now use the inspector to select elements on the screen. You can click on any element to view its details, such as the element ID, XPATH, Class name, etc.
  • Click on the icon on the left side, for which you want to create an element. For i.e. Start Chat button
  • In the above screen shot, we have clicked on Start Chat button, on the right side you can see there are multiple attributes i.e. accessibility id, id, class name, xpath etc.
  • Here, copy the value of id attribute and click on the search button on the top, nearby refresh button. Paste the value of the attribute and click on search button
  • Now, you can see the element found here we can check if the element is correct or not, by clicking on the found element.
  • Here you can see, after clicking on found element, the element is highlighted. So, we have cross checked the element. Now, can copy the value of the id attribute.

Application File Configuration #

Application file format

<environment>
  <config>
    <name>Configuration_Name</name>
    <type>mobile_application</type>
    <platform_name>Android</platform_name>
    <app_installer_path>Apk_File_Location</app_installer_path>
    <app_package_name>App_Package_Name</app_package_name>
    <app_main_activity_name>App_Activity_Name</app_main_activity_name>
    <grant_permissions>true</grant_permissions>
    <reset_app>true</reset_app>
  </config>
</environment>

Last tested and working version of these supported application are-

  • appium(version-2.5.4)
  • uiautomator2(version- 3.2.0)
  • Android studio (Electric Eel | 2022.1.1 Patch 1 January 31, 2023)

Solitera may collect certain information by automated means, such as cookies and web beacons, when a user visits our website. A “cookie” is a small piece of data that a website can send to your browser, which may then be stored on your system. learn more

Choose your Operating System