use of org.openqa.selenium.TimeoutException 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;
}
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((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 org.openqa.selenium.TimeoutException 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 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((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 org.openqa.selenium.TimeoutException in project jitsi-meet-torture by jitsi.
the class BreakoutRoomsTest method testCollapseRoom.
@Test(dependsOnMethods = { "testSendParticipantToRoom" })
public void testCollapseRoom() {
BreakoutRoomsList roomsList = participant1.getBreakoutRoomsList();
boolean visible = true;
// there should be one breakout room with one participant
TestUtils.waitForCondition(participant1.getDriver(), 5, (ExpectedCondition<Boolean>) d -> {
List<BreakoutRoomsList.BreakoutRoom> rooms = roomsList.getRooms();
return rooms.size() == 1 && rooms.get(0).getParticipantsCount() == 1;
});
// get id of the breakout room participant
String participant2Id = participant1.getDriver().findElement(By.id(BREAKOUT_ROOMS_LIST_ID)).findElements(By.className(LIST_ITEM_CONTAINER)).stream().filter(el -> !el.getAttribute("id").equals("")).findFirst().map(el -> el.getAttribute("id")).orElse("");
participant2Id = participant2Id.substring(PARTICIPANT_ITEM.length());
// check participant 2 is visible in the pane initially
TestUtils.waitForDisplayedElementByID(participant1.getDriver(), PARTICIPANT_ITEM + participant2Id, 5);
// collapse the first
roomsList.getRooms().get(0).collapse();
try {
TestUtils.waitForDisplayedElementByID(participant1.getDriver(), PARTICIPANT_ITEM + participant2Id, 3);
} catch (TimeoutException e) {
visible = false;
}
assertFalse(visible, "Participant 2 should no longer be visible");
// the collapsed room should still have one participant
TestUtils.waitForCondition(participant1.getDriver(), 5, (ExpectedCondition<Boolean>) d -> roomsList.getRooms().get(0).getParticipantsCount() == 1);
}
Aggregations