Selenium webdriver Display wait time

Source: Internet
Author: User

When the page load is slow, it is recommended to use the display wait: Wait until the element that needs to be loaded succeeds and then manipulate the element without waiting for other elements to load

webdriverwait wait = new webdriverwait (driver, 10);

Wait.until (expectedconditions.visibilityofelementlocated (by.id ("kw"));

Explicitly waiting to use the Expectedconditions class in the self-contained method, you can make a trial wait for the judgment.

Explicitly waiting for a condition that can be customized for more complex page-waiting conditions

(1) Whether the page element is available on the page and can be clicked: Elementtobeclickable (by locator)

(2) The page element is selected: elementtobeselected (webelement Element)

(3) page elements exist in the page: presenceofelementlocated (by locator)

(4) Whether a specific text is included in the page element: Texttobepresentinelement (by locator)

(5) page element value: Texttobepresentinelementvalue (by locator, java.lang.String text)

(6) Title: Titlecontains (java.lang.String title)

The test code will continue to execute the subsequent test logic backwards only if the condition satisfies the explicit wait

If the maximum explicit wait time threshold is exceeded, the test program throws an exception.

webdriverwait wait = new webdriverwait (driver,5);

Wait.until (expectedconditions.presenceofelementlocated (By.cssselector (")));

Selenium webdriver Display wait time

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.