All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.actions.SendKeysIntoTarget Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.serenitybdd.screenplay.actions;

import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.targets.Target;
import net.serenitybdd.annotations.Step;

public class SendKeysIntoTarget extends EnterValue {

    private Target target;

    public SendKeysIntoTarget(Target target, CharSequence... theText) {
        super(theText);
        this.target = target;
    }

    @Step("{0} enters #theTextAsAString into #target")
    public  void performAs(T theUser) {
        textValue().ifPresent(
                text -> target.resolveFor(theUser).sendKeys(theText)
        );
        if (getFollowedByKeys().length > 0) {
            target.resolveFor(theUser).sendKeys(getFollowedByKeys());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy