Skip to content

6 Gestures_features

Martin Großmann edited this page Jun 20, 2024 · 2 revisions

Gestures and other features

We provide the AppiumUtils to use special mobile gestures and other Appium like features.

Common device actions

Screen orientation

WebDriver driver = WEB_DRIVER_MANAGER.getWebDriver();
new AppiumUtils().rotate(driver, ScreenOrientation.LANDSCAPE);

Start native os apps

// Start iOS settings
new AppiumUtils().launchIOSApp(driver, "com.apple.Preferences");

// Run a native command at Android for wifi settings
new AppiumUtils().runCommand(driver, "am", "start", "-a", "android.settings.WIFI_SETTINGS");

Find out the current platform

Use the MobileChecker to get the used platform at runtime.

Platform platform = new MobileOsChecker().getPlatform(webDriver);
// returns Platform.IOS or PLATFORM.ANDROID

Gestures

Swipe gestures can be performed according to the directions of the compass on the device.

// Swipe from the left to the right in the middle of the screen.
new AppiumUtils().swipe(this.getWebDriver(), AppiumUtils.Swipe.LEFT);

// Do a scroll down
new AppiumUtils().swipe(this.getWebDriver(), AppiumUtils.Swipe.DOWN);