Created
February 23, 2023 16:38
-
-
Save reinskywalker/ad7ef6501a8bffbac255d1a2895e6352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class swipe { | |
AppiumDriver dr; | |
swipe() { | |
this.dr = MobileDriverFactory.getDriver() | |
} | |
private scrollList() { | |
ArrayList listElement = dr.findElementsByClassName(" isi element recyclerView / scrollView nya ") | |
TouchAction touchAction = new TouchAction(dr) | |
def bottomElement = listElement[listElement.size() - 1] | |
def topElement = listElement[0] | |
// scroll atas sampe bawah | |
touchAction.press(topElement).moveTo(bottomElement).release().perform(); | |
} | |
@Keyword | |
def boolean scrollTextByList(String elementText) { | |
boolean isFound = false; | |
while (isFound == false) { | |
ArrayList listElement = dr.findElementsByClassName(" isi scrollview / recyclerView") | |
for (int i = 0; i<listElement.size(); i++) { | |
String textItem = ((MobileElement)listElement[i]).getText() | |
if (textItem == elementText) { | |
isFound = true; | |
return true; | |
} | |
} | |
scrollList() | |
} | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment