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

com.jdiai.tools.Alerts Maven / Gradle / Ivy

There is a newer version: 1.1.8
Show newest version
package com.jdiai.tools;

import com.jdiai.JDI;
import org.openqa.selenium.Alert;

/**
 * Created by Roman Iovlev on 06.05.2021
 * Email: [email protected]; Skype: roman.iovlev
 */
public class Alerts {
    /**
     * Accept alert
     */
    public static void acceptAlert() {
        alert().accept();
    }

    /**
     * Dismiss alert
     */
    public static void dismissAlert() {
        alert().dismiss();
    }

    /**
     * Get alert text
     * @return String text
     */
    public static String getAlertText() {
        return alert().getText();
    }
    /**
     * Input the specified text in the alert and accept it
     * @param text to compare
     */
    public static void inputAndAcceptAlert(String text) {
        alert().sendKeys(text);
        alert().accept();
    }

    private static Alert alert() {
        return JDI.driver().switchTo().alert();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy