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

net.serenitybdd.screenplay.actions.selectactions.SelectByVisibleTextFromElement Maven / Gradle / Ivy

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

import net.serenitybdd.core.pages.WebElementFacade;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Interaction;
import net.serenitybdd.annotations.Step;

public class SelectByVisibleTextFromElement implements Interaction {
    private WebElementFacade element;
    private String[] options;
    private String selectedOptions;

    public SelectByVisibleTextFromElement() {}

    public SelectByVisibleTextFromElement(WebElementFacade element, String... options) {
        this.element = element;
        this.options = options;
        this.selectedOptions = String.join(",", options);
    }

    @Step("{0} selects #selectedOptions")
    public  void performAs(T theUser) {
        for(String option : options) {
            element.selectByVisibleText(option);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy