Best practice to wait for a change with Selenium Webdriver?

前端 未结 5 2337
情话喂你
情话喂你 2021-02-13 02:08

After a click event I need to wait for an elements attribute to change before proceeding further (click event causes certain elements to move out of focus and certain others get

5条回答
  •  野的像风
    2021-02-13 02:58

    You can use implicit WebDriver wait :

    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available.

    More here: http://seleniumhq.org/docs/04_webdriver_advanced.html#implicit-waits

提交回复
热议问题