Selenium Webdriver - While stuck
<p><strong>Selenium Webdriver - Chrome driver - JAVA</strong></p>

<p>I'm doing a while loop to check if a Link still exists on the page, here's the code:</p>

<pre><code>Boolean approveTrue = driver.findElements(By.linkText("Approve")).size() != 0;

    while(approveTrue){
            driver.findElement(By.linkText("Approve")).click();
            approveTrue = driver.findElements(By.linkText("Approve")).size() != 0;
            }

    driver.quit();
</code></pre>

<p>little background: Every time we click on the Approve link, the page refreshes and the link can still exists there, so we need to keep clicking on this link until it disappears, and then close the browser.</p>

<p>The loop is working fine, the problem is: when the link Approve disappears, the browser is not closed ... for some reason, this command <code>driver.quit()</code> is not being executed. Any ideas? I'm a beginner in Java, so probably I'm missing something here.</p>