'How to scroll left/right using karate appium?

I'm not able to scroll with Karate appium. My native app only shows half of the grid, i need to scroll all the way to the right, and click the button. I have tried all the friendly locators, mouse operations, special keys. Not moving at all.

mouse().move(x, y).down().move(x, y).up() What else i can use? Thank you



Solution 1:[1]

Friendly locator and Mouse API are supported only on the web so far, for native mobile. I would try script

   And driver.optional('@Views').click()
  And driver.script("mobile: scroll", { "strategy" : "accessibility id", "selector": "Seek Bar"})
  And driver.optional('@Seek Bar').click()
  And def seekbarId = driver.elementId("#io.appium.android.apis:id/seek")
  And driver.script("mobile: swipeGesture", { "elementId" : seekbarId, "direction": "left", "height": 50, "width" : 1080, "percent": 0.8 })
  And driver.delay(2000)
  And driver.script("mobile: swipeGesture", { "elementId" : seekbarId, "direction": "right", "height": 50, "width" : 1080, "percent": 0.8 })
  And driver.delay(2000)
  And driver.script("mobile: swipeGesture", { "elementId" : seekbarId, "direction": "left", "height": 50, "width" : 1080, "percent": 0.8 })

enter image description here

take a look at this android doc https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/android-mobile-gestures.md#mobile-swipegesture

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1