I am doing a test of scenarios like this:
The problem is that after login the "initial page" is taking too much to load. I only want to make a simple check on the page (1/2 elements) but it takes to long and I am losing time doing this.
So does anybody know a way to get around waiting for the page to load? (the elements I want are loaded fast +plus I wait for them after I get the context of the page)
I thought about taking the link from the button and do driver.navigate.to(link_button)
but I want to avoid this.
One thing you can do to not wait for the whole page to load is to:
specify "eager" or "none" page load strategy ( normal
is default)
normal
: This stategy causes Selenium to wait for the full page loading (html content and subresources downloaded and parsed).
eager
: This stategy causes Selenium to wait for the DOMContentLoaded event (html content downloaded and parsed only).
none
: This strategy causes Selenium to return immediately after the initial page content is fully received (html content downloaded).
use WebDriverWait
to wait for the element you need to check in this specific test scenario
And/or you can re-structure your tests and avoid navigating to the page when not logged in - eg going to login first to login -> navigate to the desired page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.