Sha256: 35d36ce58b19527bd0e73f6d431673c7b06c76064a49da56d2a50a2492b1f08a

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

package com.amplify.honeydew_server.actions;

import android.widget.TextView;
import com.android.uiautomator.core.*;
import com.amplify.honeydew_server.Action;
import com.amplify.honeydew_server.Result;

import java.util.Map;

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

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        String menuName = (String) arguments.get("menuName");

        final UiScrollable settingsMenu = new UiScrollable(new UiSelector().scrollable(true).focused(true));
        if(!isUiObjectAvailable(settingsMenu,arguments)){
            return Result.FAILURE;
        }

        final UiSelector childPattern = new UiSelector().className(TextView.class.getName());
        final UiObject childByText = settingsMenu.getChildByText(childPattern, menuName);
        if (isUiObjectAvailable(childByText, arguments)) {
            childByText.click();
            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/SelectMenuInSettings.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectMenuInSettings.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectMenuInSettings.java