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

com.sdl.selenium.jqueryui.window.Window Maven / Gradle / Ivy

Go to download

Automated Acceptance Testing. Selenium and Selenium WebDriver test framework for web applications. (optimized for dynamic html, ExtJS, Bootstrap, complex UI, simple web applications/sites)

The newest version!
package com.sdl.selenium.jqueryui.window;

import com.sdl.selenium.web.WebLocator;

public class Window extends WebLocator {

    public Window() {
        setClassName("Window");
        setBaseCls("ui-dialog ui-widget ui-widget-content");
        setStyle("display: block;");
        setTemplate("title", "count(.//*[text()='%s']) > 0");
    }

    public Window(String title) {
        this();
        setTitle(title);
    }

    public String getMessageWindow() {
        WebLocator webLocator = new WebLocator(this).setClasses("ui-dialog-content ui-widget-content");
        return webLocator.getText();
    }

    public boolean pressOK() {
        return press("Ok");
    }

    public boolean press(String textButton) {
        WebLocator webLocator = new WebLocator(this).setElPath("//button[count(.//*[text()='" + textButton + "']) > 0]");
        return webLocator.click();
    }

    public boolean pressOK(String msg) {
        if (ready()) {
            if (msg.equals(getMessageWindow())) {
                return pressOK();
            }
        }
        return false;
    }

    public boolean press(String msg, String textButton, boolean containsMsg) {
        if (ready()) {
            if(containsMsg ? getMessageWindow().contains(msg) : msg.equals(getMessageWindow())) {
                return press(textButton);
            }
        }
        return false;
    }

    public boolean press(String msg, String textButton) {
        return press( msg, textButton, false);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy