Skip to content

Commit 0b3f8ae

Browse files
author
srishti11010
committed
Changes for new sample app
1 parent 5979031 commit 0b3f8ae

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

ios/BrowserStackIOS.java

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,30 @@ public class BrowserStackIOS {
1616
public static String userName = "BROWSERSTACK_ACCESS_KEY";
1717

1818
public static void main(String args[]) throws MalformedURLException, InterruptedException {
19-
DesiredCapabilities capabilities = new DesiredCapabilities();
19+
DesiredCapabilities caps = new DesiredCapabilities();
2020

21-
capabilities.setCapability("device", "iPhone 7");
22-
capabilities.setCapability("app", "bs://<hashed app-id>");
21+
caps.setCapability("device", "iPhone 7 Plus");
22+
caps.setCapability("app", "bs://<hashed app-id>");
2323

24-
IOSDriver<IOSElement> driver = new IOSDriver<IOSElement>(new URL("http://"+userName+":"+accessKey+"@hub.browserstack.com/wd/hub"), capabilities);
24+
IOSDriver<IOSElement> driver = new IOSDriver<IOSElement>(new URL("http://"+userName+":"+accessKey+"@hub-cloud.browserstack.com/wd/hub"), caps);
2525

26-
IOSElement loginButton = (IOSElement) new WebDriverWait(driver, 30).until(
27-
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Log In")));
28-
loginButton.click();
29-
IOSElement emailTextField = (IOSElement) new WebDriverWait(driver, 30).until(
30-
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Email address")));
31-
emailTextField.sendKeys("hello@browserstack.com");
26+
IOSElement textButton = (IOSElement) new WebDriverWait(driver, 30).until(
27+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Button")));
28+
textButton.click();
29+
IOSElement textInput = (IOSElement) new WebDriverWait(driver, 30).until(
30+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Input")));
31+
textInput.sendKeys("hello@browserstack.com");
3232

33-
driver.findElementByAccessibilityId("Next").click();
3433
Thread.sleep(5000);
3534

36-
List<IOSElement> textElements = driver.findElementsByXPath("//XCUIElementTypeStaticText");
37-
assert(textElements.size() > 0);
38-
String matchedString = "";
39-
for(IOSElement textElement : textElements) {
40-
String textContent = textElement.getText();
41-
if(textContent != null && textContent.contains("not registered")) {
42-
matchedString = textContent;
43-
}
44-
}
45-
46-
System.out.println(matchedString);
47-
assert(matchedString.contains("not registered on WordPress.com"));
48-
35+
IOSElement textOutput = (IOSElement) new WebDriverWait(driver, 30).until(
36+
ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("Text Output")));
37+
38+
if(textOutput != null && textOutput.getText().equals("hello@browserstack.com"))
39+
assert(true);
40+
else
41+
assert(false);
42+
4943
driver.quit();
5044
}
5145
}

0 commit comments

Comments
 (0)