How to automate react-native carousel with appium on Mobile Apps?

217 Views Asked by At

My mobile app has introduces carousel which needs to be automated. Can this be automated using TouchActions ? Has anyone tried it before ?

Need to do it both on Android & iOS.

Carousel - https://github.com/meliorence/react-native-snap-carousel

1

There are 1 best solutions below

0
Maen Rababa On

Im using the below to handle the same:

public static void pickerWheelByCount(By by, int count, String direction) {
        try {
        AppiumDriver<MobileElement> driver = DriverManager.getDriver();
        HashMap<String, Object> params = new HashMap<>();
        params.put("order", direction);
        params.put("offset", 0.15);
        params.put("element", driver.findElement(by));
        int i = 1;

        while (i <= count) {
            i++;
            driver.executeScript("mobile: selectPickerWheelValue", params);
        } } catch(Exception e) {
            
        }
    }