Sha256: b421f2c7f52bf8ab09086638f9a3fd5cb682702b1e50d65c071b9e830e58c56c

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

package com.amplify.honeydew_server.actions;

import android.util.Log;
import com.amplify.honeydew_server.Action;
import com.amplify.honeydew_server.Result;
import com.android.uiautomator.core.*;

import java.util.Map;

public class ScrollToTextByIndex extends Action {
    public ScrollToTextByIndex(UiDevice uiDevice) {
        super(uiDevice);
    }

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        Log.i("ScrollToTextByIndex", "Found index field: " + arguments.get("index"));

        String text = (String) arguments.get("text");
        int index = Integer.parseInt((String) arguments.get("index"));

        UiSelector scrollSelector = new UiSelector().scrollable(true).index(index);
        UiScrollable uiScrollable = new UiScrollable(scrollSelector);

        if(isUiObjectAvailable(uiScrollable, arguments)){
            uiScrollable.scrollTextIntoView(text);
            return Result.OK;
        }

        return Result.FAILURE;
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
honeydew-0.17.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java