use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class JsoupHelper method getElements.
private static List<WebElement> getElements(String text, List<String> selectors) {
if (selectors.isEmpty()) {
throw new BFElementNotFoundException("Element with text [" + text + "] not found.");
}
List<WebElement> elementsToReturn = new ArrayList<WebElement>();
for (String selector : selectors) {
By elementSelector = By.cssSelector(selector);
@SuppressWarnings("deprecation") WebElement foundElement = BasePage.getDriver().findElement(elementSelector);
elementsToReturn.add(foundElement);
}
return elementsToReturn;
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class NewChromeDriver method findElement.
/**
* @deprecated As of release 1.0.0, replaced by {@link #findElementDynamic(By)()}
*/
@Deprecated
@Override
public WebElement findElement(By by) throws BFElementNotFoundException {
BaseTest.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 NewInternetExplorerDriver 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 ElementPositionUtils method isElementsPositionRelatedX.
/**
* Method checks if second element is in given relation to first element considering X coordinate
*
* @param selectorFirst
* By object with an selector
* @param selectorSecond
* By object with an selector
* @param scope
* WebElement which contains comparing objects
* @param position
* relation of a second element to first one
* @return true if two elements are placed in given relation
* @throws BFElementNotFoundException
* if elements do not exist
*/
public static boolean isElementsPositionRelatedX(By selectorFirst, By selectorSecond, WebElement scope, RelatedPositionEnum position) {
@SuppressWarnings("deprecation") WebElement elementFirst = BasePage.getDriver().findElementQuietly(scope, selectorFirst);
@SuppressWarnings("deprecation") WebElement elementSecond = BasePage.getDriver().findElementQuietly(scope, selectorSecond);
if (elementFirst == null) {
throw new BFElementNotFoundException(selectorFirst);
}
if (elementSecond == null) {
throw new BFElementNotFoundException(selectorSecond);
}
return ElementPositionUtils.isElementsPositionRelatedX(elementFirst, elementSecond, position);
}
use of com.capgemini.mrchecker.selenium.core.exceptions.BFElementNotFoundException in project devonfw-testing by devonfw.
the class DriverExtention method waitForElement.
public WebElement waitForElement(final By by) throws BFElementNotFoundException {
BasePage.getAnalytics().sendMethodEvent(BasePage.analitycsCategoryName);
long startTime = System.currentTimeMillis();
WebElement element = null;
FluentWait<WebDriver> wait = new FluentWait<WebDriver>(driver);
wait.pollingEvery(250, TimeUnit.MILLISECONDS);
wait.withTimeout(2, TimeUnit.MINUTES);
try {
element = webDriverWait().until(new Function<WebDriver, WebElement>() {
@Override
public WebElement apply(WebDriver driver) {
return driver.findElement(by);
}
});
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, BasePage.EXPLICITYWAITTIMER);
}
BFLogger.logTime(startTime, "waitForElement()", by.toString());
return element;
}
Aggregations