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

com.sdl.selenium.bootstrap.window.PopOver 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.bootstrap.window;

import com.sdl.selenium.bootstrap.button.Button;
import com.sdl.selenium.conditions.ConditionManager;
import com.sdl.selenium.conditions.ElementRemovedSuccessCondition;
import com.sdl.selenium.web.WebLocator;

import java.time.Duration;

public class PopOver extends WebLocator {

    private PopOver() {
        setInfoMessage("PopOver");
        setClasses("popover");
        setTemplate("title", "count(.//*[@class='popover-title' and text()='%s'])> 0");
    }

    public PopOver(String title, String message) {
        this(title);
        setTemplate("title", "count(.//*[@class='popover-title' and text()='%s']//following-sibling::*[@class='popover-content' and text()='" + message + "'])> 0");
    }

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

    public boolean close() {
        return new Button(this, "Close").click() && waitClose(this, Duration.ofSeconds(2));
    }

    private boolean waitClose(WebLocator popOver, Duration duration) {
        return new ConditionManager(duration).add(new ElementRemovedSuccessCondition(popOver)).execute().isSuccess();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy