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

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

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

import net.serenitybdd.core.pages.WebElementFacade;
import net.serenitybdd.screenplay.targets.Target;
import org.openqa.selenium.By;

import java.util.Arrays;

import static net.serenitybdd.screenplay.Tasks.instrumented;

public class SendKeys {

    private final CharSequence[] theText;

    public SendKeys(CharSequence... theText) {
        this.theText = theText;
    }

    public static SendKeys of(CharSequence... text) {
        return new SendKeys(text);
    }

    public EnterValue into(String cssOrXpathForElement) {
        return instrumented(SendKeysIntoTarget.class, Target.the(cssOrXpathForElement).locatedBy(cssOrXpathForElement), theText);
    }

    public EnterValue into(Target target) {
        return instrumented(SendKeysIntoTarget.class, target, theText);
    }

    public EnterValue into(WebElementFacade element) {
        return instrumented(SendKeystoElement.class, element, theText);
    }

    public EnterValue into(By... locators) {
        return instrumented(SendKeysIntoBy.class, Arrays.asList(locators), theText);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy