use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class DriverExtention method waitForElementVisible.
public WebElement waitForElementVisible(final By by) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebElement element = null;
try {
element = webDriverWait().until((Function<? super WebDriver, WebElement>) ExpectedConditions.visibilityOfElementLocated(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
}
BFLogger.logTime(startTime, "waitForElementVisible()", by.toString());
return element;
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class DriverExtention method waitForPageLoaded.
public void waitForPageLoaded() throws BFElementNotFoundException {
long startTime = System.currentTimeMillis();
final String jsVariable = "return document.readyState";
ExpectedCondition<Boolean> expectation = new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor) driver).executeScript(jsVariable).equals("complete");
}
};
int progressBarWaitTimer = BasePage.PROGRESSBARWAITTIMER;
WebDriverWait wait = webDriverWait(progressBarWaitTimer);
try {
wait.until((Function<? super WebDriver, Boolean>) expectation);
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(By.cssSelector(jsVariable), isTimeout, progressBarWaitTimer);
}
BFLogger.logTime(startTime, "waitForPageLoaded");
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class DriverExtention method findElementsDynamic.
public List<WebElement> findElementsDynamic(By by, int timeOut) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebDriverWait wait = webDriverWait(timeOut);
List<WebElement> elements = new ArrayList<WebElement>();
try {
elements = wait.until((Function<? super WebDriver, List<WebElement>>) ExpectedConditions.presenceOfAllElementsLocatedBy(by));
} catch (BFElementNotFoundException | TimeoutException e) {
throw new BFElementNotFoundException(by, true, timeOut);
}
if (elements.isEmpty()) {
BFLogger.logError("Not found element : " + by.toString() + ".");
}
BFLogger.logTime(startTime, "findElementDynamics()", by.toString());
return elements;
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class NewFirefoxDriver method findElement.
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}
*/
@Deprecated
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
WebElement elementFromDriver = null;
try {
elementFromDriver = super.findElement(by);
} catch (NoSuchElementException e) {
throw new BFElementNotFoundException(by);
}
return new NewRemoteWebElement(elementFromDriver);
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class DriverExtention method waitUntilElementIsClickable.
public WebElement waitUntilElementIsClickable(final By by) {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebElement element = null;
try {
element = webDriverWait().until((Function<? super WebDriver, WebElement>) ExpectedConditions.elementToBeClickable(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
}
BFLogger.logTime(startTime, "waitUntilElementIsClickable()", by.toString());
return element;
}
Aggregations