22
33import io .appium .java_client .AppiumBy ;
44import io .appium .java_client .ios .IOSDriver ;
5-
65import java .net .MalformedURLException ;
76import java .net .URL ;
87import java .time .Duration ;
98import java .util .HashMap ;
10-
119import org .openqa .selenium .WebElement ;
1210import org .openqa .selenium .remote .DesiredCapabilities ;
1311import org .openqa .selenium .support .ui .ExpectedConditions ;
@@ -19,7 +17,7 @@ public static void main(String[] args)
1917 throws MalformedURLException , InterruptedException {
2018 DesiredCapabilities caps = new DesiredCapabilities ();
2119 HashMap <String , Object > browserstackOptions = new HashMap <String , Object >();
22-
20+
2321 // Set your access credentials
2422 browserstackOptions .put ("userName" , "YOUR_USERNAME" );
2523 browserstackOptions .put ("accessKey" , "YOUR_ACCESS_KEY" );
@@ -29,7 +27,7 @@ public static void main(String[] args)
2927 browserstackOptions .put ("projectName" , "First Java Project" );
3028 browserstackOptions .put ("buildName" , "browserstack-build-1" );
3129 browserstackOptions .put ("sessionName" , "first_test" );
32-
30+
3331 // Passing browserstack caspabilities inside bstack:options
3432 caps .setCapability ("bstack:options" , browserstackOptions );
3533
@@ -40,7 +38,7 @@ public static void main(String[] args)
4038 caps .setCapability ("deviceName" , "iPhone 11 Pro" );
4139 caps .setCapability ("platformName" , "ios" );
4240 caps .setCapability ("platformVersion" , "13" );
43-
41+
4442 // Initialise the remote Webdriver using BrowserStack remote URL
4543 // and desired capabilities defined above
4644 IOSDriver driver = new IOSDriver (
@@ -50,15 +48,21 @@ public static void main(String[] args)
5048
5149 // Test case for the BrowserStack sample iOS app.
5250 // If you have uploaded your app, update the test case here.
53- WebElement textButton = (WebElement ) new WebDriverWait (driver , Duration .ofSeconds (30 ))
51+ WebElement textButton = (WebElement ) new WebDriverWait (
52+ driver ,
53+ Duration .ofSeconds (30 )
54+ )
5455 .until (
5556 ExpectedConditions .elementToBeClickable (
5657 AppiumBy .accessibilityId ("Text Button" )
5758 )
5859 );
5960 textButton .click ();
6061
61- WebElement textInput = (WebElement ) new WebDriverWait (driver , Duration .ofSeconds (30 ))
62+ WebElement textInput = (WebElement ) new WebDriverWait (
63+ driver ,
64+ Duration .ofSeconds (30 )
65+ )
6266 .until (
6367 ExpectedConditions .elementToBeClickable (
6468 AppiumBy .accessibilityId ("Text Input" )
@@ -67,7 +71,10 @@ public static void main(String[] args)
6771 textInput .sendKeys ("hello@browserstack.com" );
6872 Thread .sleep (5000 );
6973
70- WebElement textOutput = (WebElement ) new WebDriverWait (driver , Duration .ofSeconds (30 ))
74+ WebElement textOutput = (WebElement ) new WebDriverWait (
75+ driver ,
76+ Duration .ofSeconds (30 )
77+ )
7178 .until (
7279 ExpectedConditions .elementToBeClickable (
7380 AppiumBy .accessibilityId ("Text Output" )
0 commit comments