net.serenitybdd.screenplay.actions.EnterValueIntoTarget Maven / Gradle / Ivy
package net.serenitybdd.screenplay.actions;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.targets.Target;
import net.serenitybdd.annotations.Step;
public class EnterValueIntoTarget extends EnterValue {
private Target target;
public EnterValueIntoTarget(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).type(text)
);
if (getFollowedByKeys().length > 0) {
target.resolveFor(theUser).sendKeys(getFollowedByKeys());
}
}
}