You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a new page is loaded and after certain actions the test-execution has to wait until all needed web-elements are present in the DOM. Sometimes a loading screen (.loaderWrapper) is displayed.
Actual Approach:
a globally set implicit wait time
many explicit waits in the page object classes to wait for single web-elements to be visible/clickable/...
some Thread.sleep()
some explicit waits in the page object classes to wait for the loading screen to disappear
Problems:
implicit and explicit waits should not be mixed
unnecessary explicit waits
-> waits for certain elements which are not used afterwards (often used for a general approach, to check weather the new page is loaded and new actions can be executed on its elements)
Thread.sleep() should not be used in the tests
explicit waits for the loading screen only exist at certain points with long loading times
-> no generic approach
- Intended for all selenium methods that are constantly used with the
same wrapping code
- For now contains waitForReloadOfCurrentPage- and waitForLoadOfNewPage-
method
- Add the waitForReloadOfElement method, which should be used to wait
for a partial reload of a page (if an element is reloaded because of an
ajax request).
General Waiting-Approaches proofed to be successful:
Wait directly after a Selenium action for something to be loaded
Wait until an element is no longer attached to the DOM: WebElement elementToBecomeStale = driver.findelement(...); buttonElement.click() wait.until(ExpectedConditions.stalenessOf(elementToBecomeStale));
This can be appended by checking the loading status of the page (after the staleness-wait): wait.until(webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete"));
Wait directly before a Selenium action for the element to be available
Wait until the element is visible wait.until(ExpectedConditions.elementToBeClickable(element));
Wait until the element is clickable wait.until(ExpectedConditions.visibilityOf(element));
When a new page is loaded and after certain actions the test-execution has to wait until all needed web-elements are present in the DOM. Sometimes a loading screen (.loaderWrapper) is displayed.
Actual Approach:
Problems:
-> waits for certain elements which are not used afterwards (often used for a general approach, to check weather the new page is loaded and new actions can be executed on its elements)
-> no generic approach
TODO:
-> always wait for the loading screen if it is activated
The text was updated successfully, but these errors were encountered: