Search code examples
seleniumselenium-webdriverwebautomation

Why Wait.until() doesn't work in Selenium WebDriver?


I have been using Selenium WebDriver. I want to wait until the element is present on the webpage, for which i am using:

    WebDriverWait wait = new WebDriverWait(driver, Long.parseLong(timeout));
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator)));

but my test get stucks in the second line if the element I am looking for, is not present and even beyond the timeout. Pls Help. Thanks.


Solution

  • I got it worked. I changed the timeout from 60000 to 60 since it takes the second argument as seconds and not millisecs.