Sha256: cbab7a37d8436844b40415b1b53eb671fbcf02489baea7f159282098c09db742

Contents?: true

Size: 1001 Bytes

Versions: 3

Compression:

Stored size: 1001 Bytes

Contents

package com.amplify.honeydew_server.actions;

import com.amplify.honeydew_server.Action;
import com.amplify.honeydew_server.Result;
import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;

import java.util.Map;

public class SetTextByIndex extends Action {

    public SetTextByIndex(UiDevice uiDevice) {
        super(uiDevice);
    }

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        int index = Integer.parseInt((String) arguments.get("index"));
        String text = (String) arguments.get("text");
        UiObject textField = new UiObject(new UiSelector().className("android.widget.EditText").index(index));

        if (isUiObjectAvailable(textField, arguments)) {
            textField.setText(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/SetTextByIndex.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/SetTextByIndex.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/SetTextByIndex.java