Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/main/java/io/percy/examplepercyappiumjava/Android.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io.percy.appium.AppPercy;

public class Android {
private static AppPercy percy;

// Hub Url to connect to Automation session
private static String HUB_URL = "https://hub.browserstack.com/wd/hub";
Expand All @@ -42,7 +41,7 @@ public static void main(String[] args) throws MalformedURLException {
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL(HUB_URL), capabilities);

// Initialize AppPercy
percy = new AppPercy(driver);
AppPercy percy = new AppPercy(driver);

try {
TimeUnit.SECONDS.sleep(5);
Expand All @@ -52,13 +51,12 @@ public static void main(String[] args) throws MalformedURLException {
// Take First Screenshot
percy.screenshot("First Screenshot");


AndroidElement searchElement = (AndroidElement) new WebDriverWait(driver, 30).until(
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Search Wikipedia")));
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Search Wikipedia")));
searchElement.click();

AndroidElement textInput = (AndroidElement) new WebDriverWait(driver, 30).until(
ExpectedConditions.elementToBeClickable(MobileBy.id("org.wikipedia.alpha:id/search_src_text")));
ExpectedConditions.elementToBeClickable(MobileBy.id("org.wikipedia.alpha:id/search_src_text")));
textInput.sendKeys("Browserstack\n");

try {
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/io/percy/examplepercyappiumjava/Ios.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.percy.appium.AppPercy;

public class Ios {
private static AppPercy percy;

// Hub Url to connect to Automation session
private static String HUB_URL = "https://hub.browserstack.com/wd/hub";
Expand All @@ -40,19 +39,19 @@ public static void main(String[] args) throws MalformedURLException {
IOSDriver<IOSElement> driver = new IOSDriver<IOSElement>(new URL(HUB_URL), capabilities);

// Initialize AppPercy
percy = new AppPercy(driver);
AppPercy percy = new AppPercy(driver);

// Take First Screenshot
percy.screenshot("First Screenshot");

// Find element and click to change screen
IOSElement textButton = (IOSElement) new WebDriverWait(driver, 30).until(
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button")));
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button")));
textButton.click();

// Find textInput and send some data to it
IOSElement textInput = (IOSElement) new WebDriverWait(driver, 30).until(
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input")));
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input")));
textInput.sendKeys("[email protected]\n");

// Take Second Screenshot Post screen update
Expand Down