net.serenitybdd.screenplay.actions.SendKeystoElement Maven / Gradle / Ivy
package net.serenitybdd.screenplay.actions;
import net.serenitybdd.core.pages.WebElementFacade;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.annotations.Step;
public class SendKeystoElement extends EnterValue {
private WebElementFacade element;
public SendKeystoElement(WebElementFacade element, CharSequence... theText) {
super(theText);
this.element = element;
}
@Step("{0} enters #theTextAsAString into #element")
public void performAs(T theUser) {
textValue().ifPresent(
text -> element.sendKeys(theText)
);
if (getFollowedByKeys().length > 0) {
element.sendKeys(getFollowedByKeys());
}
}
}