Sha256: b4f4ec9ac160d5ec414cb8b9207f5b1d20755cf26c1b544196a65c70dccf281c

Contents?: true

Size: 1.18 KB

Versions: 51

Compression:

Stored size: 1.18 KB

Contents

package sh.calaba.instrumentationbackend.actions.button;


import android.widget.ImageButton;
import android.view.ViewGroup;
import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;


public class PressImageButtonDescription implements Action {

    @Override
    public Result execute(String... args) {
        String err = "No image button found with description "+args[0]+" found. Found only:";
        int index = 0;
        if (args.length == 2) {
            index = Integer.parseInt(args[1]);
        }

        int count = 0;
        for (ImageButton b : InstrumentationBackend.solo.getCurrentImageButtons()){
            err += " "+ b.getContentDescription();
            if (args[0].equals(b.getContentDescription())){
                if (count == index) {
                    InstrumentationBackend.solo.clickOnView(b);
                    return Result.successResult();
                }
                count++;
            }
        }
        return new Result(false, err);
    }

    @Override
    public String key() {
        return "press_image_button_description";
    }

}

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
calabash-android-0.4.0.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.4.0.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
testautoa-0.4.0 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.4.0.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.4.0.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.7 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.6 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.5 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
calabash-android-0.3.3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java