use of org.openqa.selenium.TimeoutException 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(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 org.openqa.selenium.TimeoutException 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(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 org.openqa.selenium.TimeoutException in project devonfw-testing by devonfw.
the class DriverExtention method findElementDynamicBasic.
private WebElement findElementDynamicBasic(By by, long startTime, int timeOut) throws BFElementNotFoundException {
WebElement element = null;
WebDriverWait wait = webDriverWait(timeOut);
try {
element = wait.until(ExpectedConditions.presenceOfElementLocated(by));
} catch (TimeoutException | NoSuchElementException e) {
boolean isTimeout = true;
throw new BFElementNotFoundException(by, isTimeout, timeOut);
}
BFLogger.logTime(startTime, "findElementDynamic()", by.toString());
return element;
}
use of org.openqa.selenium.TimeoutException in project cerberus-source by cerberustesting.
the class WebDriverService method doSeleniumActionMouseDown.
@Override
public MessageEvent doSeleniumActionMouseDown(Session session, Identifier identifier) {
MessageEvent message;
try {
AnswerItem answer = this.getSeleniumElement(session, identifier, true, true);
if (answer.isCodeEquals(MessageEventEnum.ACTION_SUCCESS_WAIT_ELEMENT.getCode())) {
WebElement webElement = (WebElement) answer.getItem();
if (webElement != null) {
Actions actions = new Actions(session.getDriver());
actions.clickAndHold(webElement);
actions.build().perform();
message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_MOUSEDOWN);
message.setDescription(message.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator()));
return message;
}
}
return answer.getResultMessage();
} catch (NoSuchElementException exception) {
message = new MessageEvent(MessageEventEnum.ACTION_FAILED_MOUSEDOWN_NO_SUCH_ELEMENT);
message.setDescription(message.getDescription().replace("%ELEMENT%", identifier.getIdentifier() + "=" + identifier.getLocator()));
LOG.debug(exception.toString());
return message;
} catch (TimeoutException exception) {
message = new MessageEvent(MessageEventEnum.ACTION_FAILED_TIMEOUT);
message.setDescription(message.getDescription().replace("%TIMEOUT%", String.valueOf(session.getCerberus_selenium_wait_element())));
LOG.warn(exception.toString());
return message;
} catch (WebDriverException exception) {
LOG.warn(exception.toString());
return parseWebDriverException(exception);
}
}
use of org.openqa.selenium.TimeoutException in project cerberus-source by cerberustesting.
the class WebDriverService method doSeleniumActionSelect.
@Override
public MessageEvent doSeleniumActionSelect(Session session, Identifier object, Identifier property) {
MessageEvent message;
try {
Select select;
try {
AnswerItem answer = this.getSeleniumElement(session, object, true, true);
if (answer.isCodeEquals(MessageEventEnum.ACTION_SUCCESS_WAIT_ELEMENT.getCode())) {
WebElement webElement = (WebElement) answer.getItem();
if (webElement != null) {
select = new Select(webElement);
this.selectRequestedOption(select, property, object.getIdentifier() + "=" + object.getLocator());
message = new MessageEvent(MessageEventEnum.ACTION_SUCCESS_SELECT);
message.setDescription(message.getDescription().replace("%ELEMENT%", object.getIdentifier() + "=" + object.getLocator()));
message.setDescription(message.getDescription().replace("%DATA%", property.getIdentifier() + "=" + property.getLocator()));
return message;
}
}
return answer.getResultMessage();
} catch (NoSuchElementException exception) {
message = new MessageEvent(MessageEventEnum.ACTION_FAILED_SELECT_NO_SUCH_ELEMENT);
message.setDescription(message.getDescription().replace("%ELEMENT%", object.getIdentifier() + "=" + object.getLocator()));
LOG.debug(exception.toString());
return message;
} catch (TimeoutException exception) {
message = new MessageEvent(MessageEventEnum.ACTION_FAILED_TIMEOUT);
message.setDescription(message.getDescription().replace("%TIMEOUT%", String.valueOf(session.getCerberus_selenium_wait_element())));
LOG.warn(exception.toString());
return message;
}
} catch (CerberusEventException ex) {
LOG.warn(ex);
return ex.getMessageError();
}
}
Aggregations