Sha256: 32e84a335df808541faa88d790b04cf50d1774812f073aaab4344f92f69f8318

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 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 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

3 entries across 3 versions & 1 rubygems

Version Path
honeydew-0.17.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.16.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java
honeydew-0.15.0 server/src/main/java/com/amplify/honeydew_server/actions/SelectFromAppsList.java