How to work with carousal sliders in Appium


I have a calendar carousal in my native application. I am looking at performing swipe left in the carousal.

I have tried various ways such as:

  1. Using X-Y coord for dragfromandtoduration
  2. driver.touchperform
    or even
  3. driver.swipe.

None seem to work. I am working with Javascript. Can anyone please help.

Sample code that I have tried:

let xcoordinate = browser.element("<xpath>").getLocation('x')
let ycoordinate = browser.element('"<xpath>").getLocation('y')

        { action: 'press', options: { x: xcoordinate, y: ycoordinate }},
        { action: 'moveTo', options: { x: 10, y: 10 }},
        { action: 'release' }

browser.execute('mobile: swipe', {direction: 'left', element: element.value.ELEMENT});