Did you have a solution how to use swipe in to element by vertical from Left to Right or Right to Left. I got my code like this, but this code only swipe for once tab menu, but I want to go to first tab menu.
This is the detail
I have 4 tab menu, A, B, C, D from tab menu A I can click button Aa and direct to tab menu D, then I want to go back to tab menu A by using the swipe because in my screen I have to do swipe to display tab menu A.
def swipeRightToLeft() {
int device_Height = Mobile.getDeviceHeight()
int device_Width = Mobile.getDeviceWidth()
int startY = device_Height / 2
int endY = startY
int startX = device_Width * 0.30
int endX = device_Width * 0.70
Mobile.swipe(startX, endY, endX, startY)
Thank you very much for your topic! It may take a little while before Katalon team member or others forum members respond to you.
In the meantime, you can double-check your post to see if you can add any extra information i.e. error logs, HTML codes, screenshots, etc. Check out this posting guide to help us help you better!
@poibematondang30 I have done this by implementing a try/catch inside of a while loop. You can either have it swipe a certain number of times or if you know the last object you will see you can have the try on that element. I have also done it where I can send the direction I would like to swipe as a parameter and then have a switch cased on the swipe action.
here is what it might look like for you. This should perform the swipe action up to 5 times until it sees the first tab menu object. It is probably not the most elegant solution but it works:
int device_Height = Mobile.getDeviceHeight()
int device_Width = Mobile.getDeviceWidth()
int startY = device_Height / 2
int endY = startY
int startX = device_Width * 0.30
int endX = device_Width * 0.70
int maxSwipes = 5
int count = 0
while (count < maxSwipes) {
try {
Mobile.verifyElementVisible(findTestObject('<first tab menu object>', 5)
return
} catch (Exception notFoundYet) {
Mobile.swipe(startX, endY, endX, startY)
}
count ++
}