From 4d914a770a0bef8314c545311400acee66c03d79 Mon Sep 17 00:00:00 2001 From: UchihaMadaraaa Date: Thu, 22 May 2025 12:45:09 +0530 Subject: [PATCH] TTN-23587 Minor changes done to get the sample Tests back in running state: 1.Changed the Download Link for Android Proverbial Apk in the .readme to point at the app this sample case was written for. 2. Changed the Locator type in IOSApp Sample test from Accessibility ID to Name as there is no Accessibility ID Attribute in the IOS proverbial App. --- README.md | 2 +- src/main/java/iOSApp.java | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 118b775..61766f6 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ curl -u "YOUR_LAMBDATEST_USERNAME":"YOUR_LAMBDATEST_ACCESS_KEY" \ > **Note:** > -> - If you do not have any **.apk** or **.ipa** file, you can run your sample tests on LambdaTest by using our sample [Android app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk) or sample [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa). +> - If you do not have any **.apk** or **.ipa** file, you can run your sample tests on LambdaTest by using our sample [Android app](https://prod-mobile-qa-artefacts.lambdatest.com/Espreeso/Proverbial.apk) or sample [iOS app](https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_ios.ipa). > - Response of above cURL will be a **JSON** object containing the `App URL` of the format - and will be used in the next step. ### **Step 2: Write Your Automation Script** diff --git a/src/main/java/iOSApp.java b/src/main/java/iOSApp.java index bd28a71..c04332c 100644 --- a/src/main/java/iOSApp.java +++ b/src/main/java/iOSApp.java @@ -1,12 +1,9 @@ import io.appium.java_client.AppiumDriver; -import io.appium.java_client.MobileBy; import io.appium.java_client.MobileElement; -import io.appium.java_client.android.AndroidElement; +import org.openqa.selenium.By; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.remote.DesiredCapabilities; import java.net.URL; @@ -44,41 +41,42 @@ public void iOSApp1(String device, String version, String platform) { WebDriverWait Wait = new WebDriverWait(driver, 30); + //Changing Locator type from Accessibility ID to Name as in the Proverbial app there is no Accessibility ID Attribute for Any Element //Changes the color of the text - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("color"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("color"))).click(); Thread.sleep(1000); //Changes the text to "Proverbial" - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Text"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Text"))).click(); Thread.sleep(1000); //Toast will be visible - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("toast"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("toast"))).click(); Thread.sleep(1000); //Notification will be visible - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("notification"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("notification"))).click(); Thread.sleep(4000); //Opens the geolocation page - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("geoLocation"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("geoLocation"))).click(); Thread.sleep(4000); //Takes back driver.navigate().back(); //Takes to speedtest page - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("speedTest"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("speedTest"))).click(); Thread.sleep(4000); driver.navigate().back(); //Opens the browser - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("Browser"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("Browser"))).click(); Thread.sleep(1000); - MobileElement url = (MobileElement) driver.findElementByAccessibilityId("url"); + MobileElement url = (MobileElement) driver.findElementByName("url"); url.click(); url.sendKeys("https://www.lambdatest.com"); - Wait.until(ExpectedConditions.presenceOfElementLocated(MobileBy.AccessibilityId("find"))).click(); + Wait.until(ExpectedConditions.presenceOfElementLocated(By.name("find"))).click(); Thread.sleep(1000); driver.quit(); } catch (Exception e) {