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

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

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

import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.abilities.BrowseTheWeb;
import net.serenitybdd.screenplay.actions.ByAction;
import net.serenitybdd.annotations.Step;
import org.openqa.selenium.By;

import java.util.Collections;
import java.util.List;

public class SelectByValueFromBy extends ByAction {
    private List values;

    public SelectByValueFromBy() {}

    public SelectByValueFromBy(String value, By... locators) {
        super(locators);
        this.values = Collections.singletonList(value);
    }

    public SelectByValueFromBy(List values, By... locators) {
        super(locators);
        this.values = values;
    }

    @Step("{0} selects #values in #locators")
    public  void performAs(T theUser) {
        values.forEach(
                value -> BrowseTheWeb.as(theUser).find(locators).selectByValue(value)
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy