Sha256: b23a36af85ef94b24c049b2e033485fdc9599a38dc4680f66495b7a95224b9df

Contents?: true

Size: 969 Bytes

Versions: 17

Compression:

Stored size: 969 Bytes

Contents

package com.amplify.honeydew_server.actions;

import android.util.Log;
import com.amplify.honeydew_server.*;
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

17 entries across 17 versions & 1 rubygems

Version Path
honeydew-0.29.1 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.29.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.28.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.27.4 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.27.3 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.27.2 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.27.1 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.27.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.25.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.24.1 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.24.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.23.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.22.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.21.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.20.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.19.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java
honeydew-0.18.0 server/src/main/java/com/amplify/honeydew_server/actions/ScrollToTextByIndex.java