Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your suggested solution only waits for <a href="https://developer.mozilla.org/en-US/docs/DOM/document.readyState" rel="noreferrer">DOM <code>readyState</code></a> to signal <code>complete</code>. But Selenium by default tries to wait for those (and a little bit more) on page loads via the <a href="https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#get-java.lang.String-" rel="noreferrer"><code>driver.get()</code></a> and <a href="https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#click--" rel="noreferrer"><code>element.click()</code></a> methods. They are already blocking, they wait for the page to fully load and those should be working ok.</p> <p>Problem, obviously, are redirects via AJAX requests and running scripts - those can't be caught by Selenium, it doesn't wait for them to finish. Also, you can't reliably catch them via <code>readyState</code> - it waits for a bit, which can be useful, but it will signal <code>complete</code> long before all the AJAX content is downloaded.</p> <p>There is no general solution that would work everywhere and for everyone, that's why it's hard and everyone uses something a little bit different.</p> <p>The general rule is to rely on WebDriver to do his part, then use implicit waits, then use explicit waits for elements you want to assert on the page, but there's a lot more techniques that can be done. You should pick the one (or a combination of several of them) that works best in your case, on your tested page.</p> <p>See my two answers regarding this for more information:</p> <ul> <li><a href="https://stackoverflow.com/a/11002061/1273080">How I can check whether page is loaded completely or not in web driver</a></li> <li><a href="https://stackoverflow.com/a/10726369/1273080">Selenium Webdriver : Wait for complex page with javascript to load</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload