Sha256: e6d01b12684aaa618dd24170ce55f79029f3fc97d624a82fba02e6f6f5086923

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

package com.amplify.honeydew_server.actions;

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

import java.util.Map;

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

    @Override
    public Result execute(Map<String, Object> arguments) throws UiObjectNotFoundException {
        String appName = (String) arguments.get("appName");
        //TODO: Using a better selector
        UiScrollable settingsMenu = new UiScrollable(new UiSelector().scrollable(true).focused(false));

        if (!isUiObjectAvailable(settingsMenu, arguments)) {
            return Result.FAILURE;
        }

        settingsMenu.setAsVerticalList();
        final UiSelector childPattern = new UiSelector().className(TextView.class.getName());
        final UiObject childByText = settingsMenu.getChildByText(childPattern, appName);

        if (isUiObjectAvailable(childByText, arguments)) {
            childByText.click();
            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/SelectFromAppsList.java
honeydew-0.29.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.28.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.27.4 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.27.3 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.27.2 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.27.1 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.27.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.25.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.24.1 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.24.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.23.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.22.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.21.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.20.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.19.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.18.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java