***URGENT - Mobile.swipe does not execute (screen stays static) but passes in log [Updated]

Studio - Version 5.4.1

Appium - Version 1.7.2

Java - Version 1.8.0_131

When executing a test case with mobile.swipe (startx starty endx endy) on a real device, the screen does not scroll to the new position, but the log displays the test step as a pass. I’ve searched this issue with no such luck. I need to have a solution by the end of the day and I need a solution that works on both android and ios real devices.

***I am using relative endx & endy positions.

Any suggestion would be appreciated!

1 Like

Console Log:

06-04-2018 02:34:53 PM - [START] - Start action : swipe
06-04-2018 02:34:54 PM - [PASSED] - Swiped from 100,600 to 0,600
[HTTP] --> GET /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/context {}
[debug] [MJSONWP] Calling AppiumDriver.getCurrentContext() with args: [“b75d8b98-0cc1-4488-a031-96b782876124”]
[debug] [MJSONWP] Responding to client with driver.getCurrentContext() result: “NATIVE_APP”
[HTTP] <-- GET /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/context 200 3 ms - 84
[HTTP] --> GET /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/contexts {}
[debug] [MJSONWP] Calling AppiumDriver.getContexts() with args: [“b75d8b98-0cc1-4488-a031-96b782876124”]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/name/.katalon/tools/android_sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“2b7e47aa29804c53”,“shell”,“cat”,"/proc/net/unix"]
[debug] [AndroidDriver] Found webviews: []
[debug] [AndroidDriver] Available contexts: [“NATIVE_APP”]
[debug] [MJSONWP] Responding to client with driver.getContexts() result: [“NATIVE_APP”]
[HTTP] <-- GET /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/contexts 200 65 ms - 86
[HTTP] --> POST /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/context {“name”:“NATIVE_APP”}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: [“NATIVE_APP”,“b75d8b98-0cc1-4488-a031-96b782876124”]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/name/.katalon/tools/android_sdk/platform-tools/adb’ with args: ["-P",5037,"-s",“2b7e47aa29804c53”,“shell”,“cat”,"/proc/net/unix"]
[debug] [AndroidDriver] Found webviews: []
[debug] [AndroidDriver] Available contexts: [“NATIVE_APP”]
[debug] [MJSONWP] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/context 200 65 ms - 76
[HTTP] --> POST /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/touch/perform {“actions”:[{“action”:“press”,“options”:{“x”:100,“y”:600}},{“action”:“wait”,“options”:{“ms”:500}},{“action”:“moveTo”,“options”:{“x”:0,“y”:600}}]}
[debug] [MJSONWP] Calling AppiumDriver.performTouch() with args: [[{“action”:“press”,“options”:{“x”:100,“y”:600}},{“action”:“wait”,“options”:{“ms”:500}},{“action”:“moveTo”,“options”:{“x”:0,“y”:600}}],“b75d8b98-0cc1-4488-a031-96b782876124”]
[debug] [JSONWP Proxy] Proxying [POST /touch/down] to [POST http://localhost:8201/wd/hub/session/cb67c68f-246d-4e26-8435-db56a1b00a75/touch/down] with body: {“params”:{“x”:100,“y”:600}}
[debug] [JSONWP Proxy] Got response with status 200: {“sessionId”:“cb67c68f-246d-4e26-8435-db56a1b00a75”,“status”:0,“value”:true}
[debug] [JSONWP Proxy] Proxying [POST /touch/move] to [POST http://localhost:8201/wd/hub/session/cb67c68f-246d-4e26-8435-db56a1b00a75/touch/move] with body: {“params”:{“x”:100,“y”:1200}}
[debug] [JSONWP Proxy] Got response with status 200: {“sessionId”:“cb67c68f-246d-4e26-8435-db56a1b00a75”,“status”:0,“value”:true}
[debug] [MJSONWP] Responding to client with driver.performTouch() result: null
[HTTP] <-- POST /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/touch/perform 200 601 ms - 76
[HTTP] --> POST /wd/hub/session/b75d8b98-0cc1-4488-a031-96b782876124/context {“name”:“NATIVE_APP”}
[debug] [MJSONWP] Calling AppiumDriver.setContext() with args: [“NATIVE_APP”,“b75d8b98-0cc1-4488-a031-96b782876124”]
[debug] [AndroidDriver] Getting a list of available webviews
[debug] [ADB] Getting connected devices…
06-04-2018 02:34:54 PM - [END] - End action : swipe

Can anyone help me? Katalon’s out-of-the-box swipe built-in keyword is not working. Need a solution for both android and ios real devices.

You can try this solution: https://medium.com/@manishboricha308/ios-mobile-swipe-action-in-katalon-studio-4911199679e

By the way, endX and endY are relative positions, not absolute positions, so please help to double check your used coordinates again.

Thanks for you answer Vinh, but I have already tried this solution for android and it’s not working.

Maybe I’m missing all the class packages. Could you provide those for me?

I have:

package jsScripts

import org.openqa.selenium.JavascriptExecutor
import com.kms.katalon.core.annotation.Keyword
import io.appium.java_client.AppiumDriver
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import org.openqa.selenium.WebDriver as driver
import io.appium.java_client.TouchAction

public class jsMobileSwipe {

@Keyword
def swipeDirection(String direction){
JavascriptExecutor js = (JavascriptExecutor) getCurrentSessionMobileDriver()
HashMap<String, String> scrollObject = new HashMap<String, String>()
scrollObject.put(“direction”, direction)
js.executeScript(“mobile: swipe”, scrollObject)
}

@Keyword
def AppiumDriver getCurrentSessionMobileDriver() {
return MobileDriverFactory.getDriver()

}

}

I’m receiving this error with the code above:

06-05-2018 09:44:30 AM - [START] - Start action : jsScripts.jsMobileSwipe.swipeDirection
06-05-2018 09:44:30 AM - [ERROR] - Unknown mobile command “swipe”. Only shell,scrollBackTo,viewportScreenshot,deepLink,startLogsBroadcast,stopLogsBroadcast,acceptAlert,dismissAlert,batteryInfo commands are supported. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘INSLE0056428MAC.local’, ip: ‘fe80:0:0:0:149e:527a:863b:1ce6%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.4’, java.version: ‘1.8.0_102’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {app: /Users/name/Downlo…, appPackage: com.dishnetwork.danyone, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {app: /Users/nameDownlo…, autoGrantPermissions: true, automationName: uiautomator2, deviceId: , deviceName: samsung SM-T820 (Android 7.0), fullReset: true, newCommandTimeout: 1800, noReset: false, platform: ANDROID, platformName: Android, udid: 2b7e47aa29804c53}, deviceApiLevel: 24, deviceId: , deviceManufacturer: samsung, deviceModel: SM-T820, deviceName: 2b7e47aa29804c53, deviceScreenDensity: 320, deviceScreenSize: 1536x2048, deviceUDID: 2b7e47aa29804c53, fullReset: true, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: false, pixelRatio: 2, platform: ANDROID, platformName: ANDROID, platformVersion: 7.0, statBarHeight: 48, takesScreenshot: true, udid: 2b7e47aa29804c53, viewportRect: {height: 2000, left: 0, top: 48, width: 1536}, warnings: {}, webStorageEnabled: false}
Session ID: 705db454-d685-4c61-88a8-cb74293b340f
06-05-2018 09:44:30 AM - [END] - End action : jsScripts.jsMobileSwipe.swipeDirection

1 Like

Dish Anywhere said:

I’m receiving this error with the code above:

06-05-2018 09:44:30 AM - [START] - Start action : jsScripts.jsMobileSwipe.swipeDirection
06-05-2018 09:44:30 AM - [ERROR] - Unknown mobile command “swipe”. Only shell,scrollBackTo,viewportScreenshot,deepLink,startLogsBroadcast,stopLogsBroadcast,acceptAlert,dismissAlert,batteryInfo commands are supported. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘INSLE0056428MAC.local’, ip: ‘fe80:0:0:0:149e:527a:863b:1ce6%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.4’, java.version: ‘1.8.0_102’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {app: /Users/name/Downlo…, appPackage: com.dishnetwork.danyone, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {app: /Users/nameDownlo…, autoGrantPermissions: true, automationName: uiautomator2, deviceId: , deviceName: samsung SM-T820 (Android 7.0), fullReset: true, newCommandTimeout: 1800, noReset: false, platform: ANDROID, platformName: Android, udid: 2b7e47aa29804c53}, deviceApiLevel: 24, deviceId: , deviceManufacturer: samsung, deviceModel: SM-T820, deviceName: 2b7e47aa29804c53, deviceScreenDensity: 320, deviceScreenSize: 1536x2048, deviceUDID: 2b7e47aa29804c53, fullReset: true, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: false, pixelRatio: 2, platform: ANDROID, platformName: ANDROID, platformVersion: 7.0, statBarHeight: 48, takesScreenshot: true, udid: 2b7e47aa29804c53, viewportRect: {height: 2000, left: 0, top: 48, width: 1536}, warnings: {}, webStorageEnabled: false}
Session ID: 705db454-d685-4c61-88a8-cb74293b340f
06-05-2018 09:44:30 AM - [END] - End action : jsScripts.jsMobileSwipe.swipeDirection

hI,

same problem…

Do you have solution ?

Thanks @Vinh Nguyen

Hi there

Same problem…

it doesn’t work… any solution please… not able to find any work around as well… please help…

Shweta sao said:

Hi there

Same problem…

it doesn’t work… any solution please… not able to find any work around as well… please help…

I am also facing same issue running swipe on mobile. Any solution?

Hi there!

This solution helped me to solve issue with vertical scroll. Maybe, it will be helpful for somebody

import io.appium.java_client.TouchAction
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobileDriverFactory
import io.appium.java_client.AppiumDriver as AppiumDriver
AppiumDriver<?> driver = MobileDriverFactory.getDriver()
while (	Mobile.waitForElementPresent(categoryText, 2, FailureHandling.STOP_ON_FAILURE) == false){
//Mobile.swipe(300, 1430, 300, 1200)	//does not work in Katalon studio (it taps on the position but does not scroll)
TouchAction ta = new TouchAction(driver);
ta.press(startX, startY).waitAction().moveTo(endX, endY).release().perform();
}
5 Likes

Thanks for the solution,but its not working… it shows swipe test step as passed but in actual its not doing(Swipe) anything…

Do you have some solution? I also have the same issue…

according to your method, I succeeded to vertical scrol, thank you for much!