Skip to main content

Use Appium to Enable Automation in AstroFarm for Android Devices

To enable automation in AstroFarm using Appium,

1.  Log into the AstroFarm console. 

2.  Search for the Android device that you want to use for automation and click Use.

3.  Navigate to the Dashboard and copy the command from Remote debug.

     alt text

4.  On the Command prompt, go to the adb path and paste the command copied in the previous step.

note

ADB version should be the latest.

5.  Check if the device is connected through adb by typing the following command in the Command prompt:

   adb devices 

   

   alt text

 6.  Start the Appium server using the below command (if Appium is installed through node and npm). 

   appium  

alt text

      (Or)

      You can use the Appium desktop sever to start the Appium server. 

7.  Trigger the scripts that need to be executed.

8.  Below capabilities are required for Appium configuration:


   DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "DeviceName from adb device list");
caps.setCapability("platformName", "Android");
caps.setCapability("appPackage", appPackage);
caps.setCapability("appActivity", activity);
caps.setCapability("adbExecTimeout",100000);
caps.setCapability("uiautomator2ServerInstallTimeout",20000);
caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT,20000);
caps.setCapability("testdroid_testTimeout", 20000);
caps.setCapability("noReset", “true”);
caps.setCapability("fullReset", “false”);
driverAppium = new AndroidDriver\WebElement(new URL(“http://127.0.0.1:4723/wd/hub”),caps);

9.  Use the following command to quit an Appium session.

            driverAppium.quit();

     Quit method should be added in afterTest() or afterClas() methods.