Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created July 15, 2022 17:22
Show Gist options
  • Save SarahElson/2e877204955a662aa6bdc39a94e1a439 to your computer and use it in GitHub Desktop.
Save SarahElson/2e877204955a662aa6bdc39a94e1a439 to your computer and use it in GitHub Desktop.
Automated App Testing Using Appium With TestNG [Tutorial]
package com.lambdatest.appium.sample.pages;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import com.lambdatest.appium.sample.enums.Platform;
import io.appium.java_client.MobileBy;
import org.openqa.selenium.By;
public class HomePage {
// 1.
public Map<Platform, By> message () {
return ImmutableMap.of (Platform.IOS, MobileBy.AccessibilityId ("Textbox"), Platform.ANDROID,
By.id ("Textbox"));
}
// 2.
public Map<Platform, By> notificationButton () {
return ImmutableMap.of (Platform.IOS, MobileBy.AccessibilityId ("notification"), Platform.ANDROID,
By.id ("notification"));
}
// 3.
public Map<Platform, By> proverbialNotification () {
return ImmutableMap.of (Platform.IOS, MobileBy.iOSNsPredicateString ("label BEGINSWITH \"PROVERBIAL\""),
Platform.ANDROID, By.id ("android:id/title"));
}
// 4.
public Map<Platform, By> textButton () {
return ImmutableMap.of (Platform.IOS,
MobileBy.iOSNsPredicateString ("label == \"Text\" AND type == \"XCUIElementTypeButton\""), Platform.ANDROID,
By.id ("Text"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment