pCloudy Mobile Commands
  • 29 Mar 2023
  • 1 Minute to read
  • Dark
    Light

pCloudy Mobile Commands

  • Dark
    Light

Article Summary

Overview

Use Appium Client methods to use pCloudy API's in automation scripts. By using the code mentioned below, users can send commands to the mobile devices used for automation testing. This will help users to use pCloudy features in their test automation to bring more values to functional tests.


CommandDescription
driver.executeScript
("pCloudy_executeAdbCommand", "ADB_COMMAND");
User can execute adb command on the booked device during the Appium session.

Example:- Object obj = driver.executeScript("pCloudy_executeAdbCommand", "adb devices"); System.out.println("@Output: " + obj);
driver.executeScript
("pCloudy_getNetworkSimulationProfiles");
User can get what are all network profiles there according to that user can simulate the network.

Example:- Object profileString = driver.executeScript("pCloudy_getNetworkSimulationProfiles");String[] profileArray = profileString.toString().split(","); System.out.println("@Devices:" + obj);
driver.executeScript
("pCloudy_shapeNetworkSimulation", "Profile_Name");
User can set the network profiles like 3G, 4G etc.

Example:- Object profileString = driver.executeScript("pCloudy_getNetworkSimulationProfiles"); String[] profileArray = profileString.toString().split(","); driver.executeScript("pCloudy_shapeNetworkSimulation", profileArray[4]);
driver.executeScript
("pCloudy_unShapeNetworkSimulation");
User can unset network profiles.

Example:- driver.executeScript("pCloudy_unShapeNetworkSimulation");
driver.executeScript
("pCloudy_setAndroidLocation", "lattitude","longitude");
User can set the Android location using lattitude and longitude.

Example:- obj1 = driver.executeScript("pCloudy_setAndroidLocation", "1.2345d","1.2345d");
driver.executeScript
("pCloudy_switchDeviceLocation", "true/false");
User can toggle device location.

Example:- Object obj1 = driver.executeScript("pCloudy_switchDeviceLocation", "true");
driver.executeScript
("pCloudy_enablewifi", "true/false");
User can toggle wifi.

Example:- driver.executeScript("pCloudy_enablewifi", "true");
driver.executeScript
("pCloudy_getVideo", "true");
User can get the video during Appium session.

Example:- driver.executeScript("pCloudy_getVideo", "true");
Map<String, Object> params = new HashMap<>();
params.put(""enableRecord"", true);
System.out.println(driver.executeScript(""mobile:video:record"",params));
User can get a video for every test cases during appium session.
Map<String, Object> params = new HashMap<>();
params.put("enableRecord", false);
System.out.println(driver.executeScript("mobile:video:record",params));
To stop a video generation during appium session.
driver.executeScript("pCloudy_getReportLink");To get a report link.

Example:- String link = (String) driver.executeScript("pCloudy_getReportLink"); System.out.println(link);
Map<String, Object> params = new HashMap<>();
params.put("getDeviceUrl", true);
System.out.println(driver.executeScript("mobile:device:url",params));
Get the link to see the live view of stream based devices.
Map<String, Object> params = new HashMap<>();
params.put("auth", true);
System.out.println(driver.executeScript("mobile:fingerprint:auth",params));
Biometric automation on Android devices.
Map<String, Object> params = new HashMap<>();
params.put("auth", true);
System.out.println(driver.executeScript("mobile:biometric:auth",params));
Biometric automation on IOS devices.
driver.executeScript("pCloudy_injectImage","QR_code_G.png" );To Inject QR code Image.

Example:- Object
ob=driver.executeScript("pCloudy_injectImage","QR_code_G.png" ); System.out.println(ob);
Map<String, Object> params = new HashMap<>();
params.put("profileName", "4G-LTE-Advanced");
System.out.println(driver.executeScript("mobile:network:start",params));
To start network simulation. User can get what are all network profiles there according to that user can simulate the network.
Map<String, Object> params = new HashMap<>();
params.put("profileName", "4G-LTE-Advanced");
System.out.println(driver.executeScript("mobile:network:stop",params));
To unset network profiles.
Map<String, Object> params = new HashMap<>();
driver.executeScript("mobile:ocr:text",params);
To get all the text present in an image
Map<String, Object> params = new HashMap<>();
params.put("baseImageId", "firstImageId");
params.put("secondImageId", "secondImageId");
driver.executeScript("mobile:visual:imageDiff",params);
To compare and find the difference between two images
Map< String, Object> params = new HashMap<>();
params.put("imageId", "ID");
params.put("word", "abc");
System.out.println(driver.executeScript("mobile:ocr:textExists",params));;
To verify if any word exists or not in an image
Map< String, Object> params = new HashMap<>();
params.put("imageId", ID);
params.put("word", "abc");
System.out.println(driver.executeScript("mobile:ocr:coordinate",params));
To find the “coordinates” of a word
Map<String, Object> params = new HashMap<>();
params.put("transactionName", "Name of transaction file");
params.put("enableHar",true);
params.put("harFileName", "Har file Name");
driver.executeScript("mobile:transaction:start",params);
To start the transaction execution with har file
Map<String, Object> params = new HashMap<>();
driver.executeScript("mobile:transaction:stop",params);
To stop the transaction execution
Map<String, Object> params = new HashMap<>();
params.put("orientation", "L");
System.out.println(driver.executeScript("mobile:device:rotate",params));
To rotate the device in landscape mode
Map<String, Object> params1 = new HashMap<>();
params1.put("orientation", "P");
System.out.println(driver.executeScript("mobile:device:rotate",params1));
To rotate the device in portrait mode.



Was this article helpful?

What's Next