Skip to content

Commit

Permalink
Added overloaded scrollToAnElementByText() to get control over number…
Browse files Browse the repository at this point in the history
… of times to scroll (#412)

* added overloaded scrollToAnElementByText() to get control over number of times scroll to be done

* removed unnecessary append

---------

Co-authored-by: Snehith Tammewar <tammewar.snehith@ril.com>
  • Loading branch information
snehith07 and Snehith Tammewar authored Nov 2, 2023
1 parent 1e90fa6 commit ab30813
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/znsio/teswiz/runner/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public WebElement scrollToAnElementByText(String text) {
"new UiScrollable(new UiSelector())" + ".scrollIntoView(new UiSelector().text(\"" + text + "\"));"));
}

public WebElement scrollToAnElementByText(String text, int maxSwipes) {
return driver.findElement(AppiumBy.androidUIAutomator(
"new UiScrollable(new UiSelector().scrollable(true)).setMaxSearchSwipes(" + maxSwipes + ").scrollIntoView(new UiSelector().text(\"" + text + "\"));"));
}

public boolean isElementPresent(By locator) {
return !driver.findElements(locator).isEmpty();
}
Expand Down

0 comments on commit ab30813

Please sign in to comment.