How do I swipe to next scrren or tap on small dot button located on above home screen

Hi,

Can some one help me to know how do I swipe to next screen or tap on a button , in Samsung galaxy S6 will get two dot button, when tap on either one will change the screen from 1to 2 vice versa, but Katalon object spy is not able to read the properties of this two dot buttons, Please do find in screenshot…
How do I tap
How do I swipe

please help me

Hi @satish1607,

Here are some instructions on how to do swiping on mobile:

https://docs.katalon.com/katalon-studio/docs/mobile-swipe.html

Hope this helps,

Chris

Thanks for the update but nothing is happening on screen while executing the
Mobile.swipe(200, 300, 400, 600) commands

please do let me know exactly how it works my job is to swipe left or right to next screen

regards
Satish

Hi @satish1607,

Could you please share what you have in your test script so far?

Thanks,

Chris

Hi Chris,

You can see on attached screenshot in Galaxy S6 I have go to screen, From Home once I will tap on AppView button 1st screen will open(1in screenshot) then I can tap on dot or swipe left by hand to move to other screen, Similiraly from screen 2(2nd in screenshot) I can swipe right to come to the 1st screen.

SpyMobile or Recorder is not able to identify this two dots its coming out of frame.

So please do let me know how I can achieve this
Mobile height and weidth is 2560x1440. To move to other screen what value I should give in Swipe (x,x,x,x)

Thanks

Hi @satish1607,

I tried a really simple example for swiping on the Android home screen, and this worked for me:

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

// Need to choose some apk to start things off 
Mobile.startApplication('sometestapp.apk', true)

// Close the apk and get back to the home screen
Mobile.pressBack()

// Swiping right to left
Mobile.swipe(1200, 100, 10, 100)
// NOTE: if you're using an older version of Katalon Studio, the 3rd and 4th parameters are *relative* coordinates
// Mobile.swipe(1200, 100, -1000, 0)

// Swiping left to right (the 3rd and 4th parameters are *relative* coordinates to the starting point)
Mobile.swipe(10, 100, 1200, 100)
// NOTE: if you're using an older version of Katalon Studio, the 3rd and 4th parameters are *relative* coordinates
// Mobile.swipe(10, 100, 1000, 0)

Mobile.delay(10)

Mobile.closeApplication()

Hope this helps,

Chris

Thanks Chris for the help, Still I am unable to make it work, Horizontal swipe is working when I open the Chrom browser with long page then able to swipe but

When list of icon open and I need to swipe from right to left or left to right not able to swipe don’t know why.

Please find my testcase below in screenshot.

Hi @satish1607,

For the Swipe command, can you try a couple of things:

  • Switch the coordinates to 1300; 500; 0; 500
  • If that doesn’t work, switch them to 1300; 500; -1000; 0

I’m hoping that one of these will work with the coordinates of your phone.

– Chris

Thanks Chris it worked for me, by following below code.

//For left to right swipe
Mobile.swipe(1300, 500, 0, 500, FailureHandling.CONTINUE_ON_FAILURE)

//for right to left swipe.
Mobile.swipe(0, 500, 1300, 500)

Thanks Again. Cheers

1 Like

I am unable to use Set Slider Value feature everytime its getting fail. Please do help me and found the code below.

Mobile.startApplication(‘C:\Users\Admin\Desktop\apk1\BTSmart.apk’, false)

Mobile.tap(findTestObject(‘Zoom and Pinch/Click to streamCamera’), 0)

Mobile.delay(25, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.tap(findTestObject(‘Zoom and Pinch/Camera_Zoom’), 0)

Mobile.delay(7, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.checkElement(findTestObject(‘Zoom and Pinch/android.widget.SeekBar0 - 0.0’), 5)

Mobile.delay(7, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.checkElement(findTestObject(‘Zoom and Pinch/android.widget.SeekBar0 - 0.0’), 5)

Mobile.delay(7, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.setSliderValue(findTestObject(‘Zoom and Pinch/android.widget.SeekBar0 - 0.0’), 70, 5)

Mobile.delay(7, FailureHandling.CONTINUE_ON_FAILURE)

Mobile.tap(findTestObject(‘Zoom and Pinch/SeekBarLeyout’), 5)

@Chris_Trevarthen hello
How can I swipe right to left?
Please help me

image

image

Hey @Zarashima!
Can you take a look at this problem, too?

Hey @ehtimadi and @Chris_Trevarthen!
I have the same problem just like @ehtimadi and I cannot continue my mobile automation tests because of this situation., please can you help us about this?

What have you tried?
Did you try the accepted solution above?

//For left to right swipe
Mobile.swipe(1300, 500, 0, 500, FailureHandling.CONTINUE_ON_FAILURE)

//for right to left swipe.
Mobile.swipe(0, 500, 1300, 500)

(note that coordinates may vary depending on your screen size and resolution)

Hello @Dan_Bown!
My mobile devices are changing sizes for my automation tests. That’s why I’m looking for a more effective way. Is there a function in Katalon that gives the screen location of an object? Can you help with this?

I can provide another document that describes swiping up and down but should be a good approach to scrolling/swiping in any direction (with any size screen). You say you’re looking for ‘location of an object’ though - that is not what a swipe does, it is not looking for an object at all, just two sets of coordinates. To move a screen to the right, you move your finger from right-to-left and you just need to tell Katalon where your swipe should start and finish.

This document also uses Mobile.getDeviceWidth() to get your device’s actual width, which might be more robust than providing a number in pixels that may change as your devices change. Handling Vertical Swipe in Mobile Automation | Katalon Docs

Hey @Dan_Bown!
I am attaching a photo of the situation in this comment that I want to do. In my test scenario, I need to remove the product with the delete button that comes after swiping a specific object to the left. Is there a sample code I can use for this?

I think I see what you are saying now, you need to swipe a specific element to trigger/reveal a new option called ‘Delete’? You probably need to look at the Katalon mobile keywords available in order to (I guess):

  1. identify the correct element
  2. get element top position (gives your ‘y’ coordinate)
  3. get element left position (gives your ‘x’ coordinate)
  4. get element width
  5. get element height
  6. work out the coordinates of your element
  7. swipe, based on the coordinates obtained
  8. Click the ‘Delete’ element
    I don’t have any examples personally but perhaps someone here has a keyword for such a job?

Thanks a lot @Dan_Bown :slight_smile: I will try it! If i can handle it, i will share the solution until then if anyone has a exact solution please help us about this situtation :slight_smile:

Hi,
here is the solution

left = Mobile.getElementLeftPosition(findTestObject(‘your object id’),
0)

top = Mobile.getElementTopPosition(findTestObject(‘your object id’), 0)

width = Mobile.getElementWidth(findTestObject(‘your object id’), 0)

Mobile.delay(5)

Mobile.tapAtPosition((left + width) - 10, top + 10)