Sha256: 8fbf6aca1342f9a451c23a257f721f1a28fa605c9f3b69ac676638897b7c3d99

Contents?: true

Size: 996 Bytes

Versions: 3

Compression:

Stored size: 996 Bytes

Contents

package com.amplify.honeydew_server.actions;

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 com.amplify.honeydew_server.Action;
import com.amplify.honeydew_server.Result;

import java.util.Map;

public class SetTextByLabel extends Action {

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

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        String label = (String) arguments.get("label");
        String inputText = (String) arguments.get("text");
        UiObject textField = new UiObject(new UiSelector().text(label));

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