Some Basics Commands to Execute in Mobile Automation-Appium
– One of App Installation Commands
driver.installApp(“Location of the apk file”);
– One of Commands To Verify App is Installed
driver.isAppInstalled(“app package name”);
– One of Commandd to Remove App
driver.removeApp();
– Commands to Launch Mobile App
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL(“http://127.0.0.1:4723/wd/hub”), caps);
or
AndroidDriver driver = new AndroidDriver(new URL(“http://127.0.0.1:4723/wd/hub”), caps);
– One of Commands to Single Tap
TouchActions action = new TouchActions(driver);
action.singleTap(Element element);
action.perform();
– One of Commands to Double Tap
TouchActions action = new TouchActions(driver);
action.doubleTap(Element element);
action.perform();
– Press Key Command
driver.pressKeyCode(AndroidKeyCode.HOME); // This is Example Key
or
driver.pressKeyCode(5); // This is Example Key
-Show Keyboard
driver.getKeyboard();
– To Hide Keyboard
driver.hideKeyboard();
– Command to Rotate Device
driver.rotate(ScreenOrientation.POTRAIT);
or
driver.rotate(ScreenOrientation.LANDSCAPE);
– One of Commands To Get Device Name
driver.getDeviceTime();
– One of Commands To Know Device Time
driver.getDeviceTime();
– Command to Lock Device
driver.lockDevice();
– Command to Unlock Device
driver.unLockDevice();
– Command to Open Notification
driver.openNotification();
– Command to Know Device is Locked
driver.isLocked();
– One of Commands to Scroll Screen
TouchActions action=new TouchActions(driver);
action.scroll(x, y).perform(); // need to add x and y offset
– One of Commands to Long Press on Element
driver.longPress(WebElement element);
– One of Commands to Know Current Setting of Device
Map settings = driver.getSettings();
– One of Commands to Know Current Location of Device and to Set New
driver.Location();
Location location = new Location(56.46854, 15.63145, 506); // This is for Example
driver.setLocation(location);
Note:- These are some basics commands but there may be more challenges so keep learning.