How to check if current Orientation is Portrait?

public boolean Method_isCurrentOrientationPortrait(AppiumDriver driver) { String ort = driver.getOrientation().name(); ScreenOrientation orientation = ScreenOrientation.valueOf(ort); if (orientation == ScreenOrientation.PORTRAIT) { return true; } else { return false; } }

How to swipe on seekbar?

private void swipeOnSeekbar(AppiumDriver driver, WebElement element, int percentage) { Point point = element.getLocation(); Dimension eleSize = element.getSize(); int startX = point.getX(); int startY = point.getY() + (eleSize.getHeight() / 2); int …

Ignore webviews pointed to blank url

Code: caps.setCapability(“ignoreAboutBlankUrl”, true); Ignore webviews which are pointed to the about:blank url. These webviews will not appear in the context list and you cannot set the context to these webviews. …

Unlock type

Code: caps.setCapability(“unlockType”,pattern); “Used to select a method of unlocking the device.If set to null, the Appium Settings App is used to unlock the device. For how to unlock via PIN …

What is autoGrantPermissions Capabilities?

Have Appium automatically determine which permissions your app requires and grant them to the app on install. If noReset capability is true, this capability doesn’t work. Eg:-capabilities.setCapability(“autoGrantPermissions”, false); Valid Values:-true,false …

How to print safari browser console log?

public void printSafaraConsoleLog(AppiumDriver driver) { if (driver != null) { for (LogEntry entry : driver.manage().logs().get(“safariConsole”)) { HashMap consoleEntry = new Json().toType(entry.getMessage(), Json.MAP_TYPE); System.out.println(String.format(“%s [%s] %s”, entry.getTimestamp(), entry.getLevel(), consoleEntry.get(“text”))); } } …