Hi @rkarim,
You could try switching the longPress
with just press
to see if the longPress is holding too long and maybe not letting the swipe happen.
– Chris
Hi @rkarim,
You could try switching the longPress
with just press
to see if the longPress is holding too long and maybe not letting the swipe happen.
– Chris
I forgot to mention that I also added a Swipe
functionality to an open source utility that might take some of the hard work out of it for you. It does basically the same thing behind the scenes as what you’re trying to do in your test:
You can download the jar file and place it in the /Drivers
directory of your test: https://github.com/detroit-labs/katalon-mobile-util/releases/download/1.13.1/katalon-mobile-util-1.13.1.jar
– Chris
Hi Chris,
The katalon-mobile-util seems like a great option but I would need your step by step instruction on how to utilize this method, if possible
So far I can download it and place in the driver folder of katalon studio main file
what then?
The installation process seems to be really complicated for me to honest it will be greatly appreciated if you can guide me through
Hi @rkarim,
/Drivers
directory of your test projectSwipe
:import com.detroitlabs.katalonmobileutil.touch.Swipe
import com.detroitlabs.katalonmobileutil.touch.Swipe.SwipeDirection
Swipe.swipe(SwipeDirection.BOTTOM_TO_TOP)
NOTE: This code replaces everything from your int startX=360
line to the last ta.longPress()
function - all of that code is built into the library!Hope this helps,
Chris
Hey Chris,
there is already a jar file called: katalon-mobile-util-1.9.0 in driver folder do I replace it with your one or should I just leave both on the folder location?
Just tried Swipe.swipe(SwipeDirection.BOTTOM_TO_TOP) with your instruction but the screen vibrates for a little bit but doesn’t swipe at all this is so frustrating, I’m sorry for bugging you but I’m running out of options
Hi Chris,
I also tried press instead of longPress and the screen didn’t do anything instead it tapped on a different drop down field within the screen
This is what I’ve used for my code:
int startX = 360
int startY = 816
int endX = 360
int endY = 204 // scrolling down, so the ending point is ABOVE the starting point
AppiumDriver<?> driver = MobileDriverFactory.getDriver()
TouchAction ta = new TouchAction(driver)
ta.press(PointOption.point(startX, startY)).moveTo(PointOption.point(endX, endY)).release().perform()
NOTE: I have a feeling that my x and y coordinates might be wrong I’m using a different OS and a different device for this test what do you think?
Yes, go ahead and remove the old jar.
Ok great, My physical screen height is 1280 and width is 720 I think this would change the x and y coordinates right? For previous screen is was 1289 and 720
A different screen size could change the coordinates, but only 9 pixels probably doesn’t change that much. Any chance you could send a screenshot and/or video of the screen you’re trying to swipe?
– Chris
Are you trying to scroll the entire screen or the individual dropdown lists? If it’s the entire screen, I wonder if the tap is actually picking up the drop-down list instead. What if you tried changing your startX
and endX
values to something much smaller (on the left of the screen), like 5
?
– Chris
So you don’t know me to use the DetroitLab mobile util that you have provided me?
So you want me to change my coordinates to the following:
int startX = 355
int startY = 816
int endX = 355
int endY = 204 // scrolling down, so the ending point is ABOVE the starting point
AppiumDriver<?> driver = MobileDriverFactory.getDriver()
TouchAction ta = new TouchAction(driver)
ta.press(PointOption.point(startX, startY)).moveTo(PointOption.point(endX, endY)).release().perform()
[/quote]
I just changed my 360 value to 355 which is 5 less
Is this how you want me to try it out?
Hi @rkarim,
For now, let’s go back to the code that you have where you’re writing out ta.press...
so that we can better control where you’re tapping. In this case, let’s try setting the values like this:
int startX = 5 // try to keep the x value out of the way of the drop-downs
int startY = 1000 // start close to the bottom of the screen, but not all the way
int endX = 5
int endY = 204 // scrolling down, so the ending point is ABOVE the starting point
AppiumDriver<?> driver = MobileDriverFactory.getDriver()
TouchAction ta = new TouchAction(driver)
ta.press(PointOption.point(startX, startY)).moveTo(PointOption.point(endX, endY)).release().perform()
Hope this helps,
Chris
Hey Chris,
Nothing happened after implementing the code you see my application has a swipe left and right functionality so the code you posted earlier is trying to bring the previous screen a little bit but not completing the action but the screen didn’t move vertically at all
Hi Chris,
My Demo is today everything in my script is working except fo the swipe action please. I did however try the mobile utility jar file that you suggested earlier but it works when it wants to but I know sometimes it works for sure. I think we are very very close but just something very small wrong please help.
Hi @Chris_Trevarthen, please help me. I have tried many options but not one is working.
I want to swipe the mobile screen horizontally.
Hi,
You could try using the Swipe keyword https://docs.katalon.com/katalon-studio/docs/mobile-swipe.html#description, with Y remaining the same and changing the X value.
Kindly notify if that works.
Best,
Chris