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

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

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

import net.serenitybdd.core.pages.ClickStrategy;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.annotations.Step;
import org.openqa.selenium.By;

import java.util.List;

import static net.serenitybdd.core.pages.ClickStrategy.*;

public class ClickOnBy extends ByAction implements ClickInteraction {

    private ClickStrategy clickStrategy = WAIT_UNTIL_PRESENT;

    @Step("{0} clicks on #locators")
    public  void performAs(T theUser) {
        resolveFor(theUser).click(clickStrategy);
    }

    public ClickOnBy(By... locators) {
        super(locators);
    }

    public ClickOnBy(List locators) {
        super(locators.toArray(new By[]{}));
    }

    @Override
    public ClickOnBy afterWaitingUntilEnabled() {
        clickStrategy = WAIT_UNTIL_ENABLED;
        return this;
    }

    @Override
    public ClickOnBy afterWaitingUntilPresent() {
        clickStrategy = WAIT_UNTIL_PRESENT;
        return this;
    }

    @Override
    public ClickInteraction withNoDelay() {
        clickStrategy = IMMEDIATE;
        return this;
    }

    @Override
    public ClickInteraction withStrategy(ClickStrategy clickStrategy) {
        this.clickStrategy = clickStrategy;
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy