use of org.openqa.selenium.support.ui.WebDriverWait 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.support.ui.WebDriverWait 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.support.ui.WebDriverWait in project archiva by apache.
the class AbstractArchivaTest method deleteUser.
public void deleteUser(String userName, String fullName, String emailAd, boolean validated, boolean locked) {
clickLinkWithLocator("menu-users-list-a");
WebDriverWait wait = new WebDriverWait(getWebDriver(), 10);
wait.until(ExpectedConditions.elementToBeClickable(By.id("users-grid-delete-" + userName)));
assertTextPresent(userName);
assertTextPresent(fullName);
clickLinkWithLocator("users-grid-delete-" + userName);
wait.until(ExpectedConditions.elementToBeClickable(By.id("dialog-confirm-modal-ok")));
clickLinkWithLocator("dialog-confirm-modal-ok");
wait.until(ExpectedConditions.elementToBeClickable(By.id("alert-message-success-close-a")));
assertTextPresent("User " + userName + " deleted.");
clickLinkWithLocator("alert-message-success-close-a");
assertElementNotPresent("users-grid-user-id-" + userName);
assertTextNotPresent(fullName);
}
use of org.openqa.selenium.support.ui.WebDriverWait in project archiva by apache.
the class AbstractArchivaTest method logout.
protected void logout() {
clickLinkWithLocator("logout-link-a");
WebDriverWait wait = new WebDriverWait(getWebDriver(), 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[text()='Login']//ancestor::a")));
assertTextNotPresent("Current User:");
assertLinkNotVisible("Edit Details");
assertLinkNotVisible("Logout");
assertLinkVisible("Login");
}
use of org.openqa.selenium.support.ui.WebDriverWait in project archiva by apache.
the class AbstractSeleniumTest method selectValue.
public WebElement selectValue(String locator, String value, boolean scrollToView) {
int count = 5;
boolean check = true;
WebDriverWait wait = new WebDriverWait(getWebDriver(), 10);
WebElement element = null;
while (check && count-- > 0) {
try {
element = findElement(locator);
List<WebElement> elementList = new ArrayList<>();
elementList.add(element);
wait.until(ExpectedConditions.visibilityOfAllElements(elementList));
check = false;
} catch (Throwable e) {
logger.info("Waiting for select element {} to be visible", locator);
}
}
Select select = new Select(element);
select.selectByValue(value);
return element;
}
Aggregations