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

io.nosqlbench.driver.webdriver.verbs.AcceptAlert Maven / Gradle / Ivy

package io.nosqlbench.driver.webdriver.verbs;

import io.nosqlbench.driver.webdriver.WebContext;
import org.openqa.selenium.Alert;

import java.security.InvalidParameterException;

public class AcceptAlert implements WebDriverVerb {
    @Override
    public void execute(WebContext context) {
        Alert alert = context.getAlert();
        if (alert==null) {
            alert = context.driver().switchTo().alert();
        }
        if (alert==null) {
            throw new InvalidParameterException("Alert is not present");
        }
        alert.accept();
        context.clearAlert();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy