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

com.github.siwenyan.si.SiCommandExecutorWaitForElementNotVisible Maven / Gradle / Ivy

There is a newer version: 1.25.1.0
Show newest version
package com.github.siwenyan.si;

import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

class SiCommandExecutorWaitForElementNotVisible extends SiCommandExecutor implements ISiCommandExecutorFlagUi {

    @Override
    public void execute(SiCommand command, SiContext siContext) throws SiVerifyException, SiWebDriverException {
        By by = siContext.by(command.getSiModelCommand().getTarget());
        long timeOutInMilliseconds = 10000;

        try {
            timeOutInMilliseconds = Integer.parseInt(command.getSiModelCommand().getValue());
        } catch (Exception e) {
            // do nothing
        }

        WebDriverWait wait = new WebDriverWait(siContext.asWebDriver(), timeOutInMilliseconds / 1000);

        long lastMilliseconds = System.currentTimeMillis() + timeOutInMilliseconds;
        wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy