I'm trying to use explicit wait to wait for an element to be present in the DOM. In this example, I have a login form which when the submit button is pressed, displays a Loading div, then once login is validated, the user is redirected to the logged in area. This process takes up to 10 seconds. To verify I've reached the logged in area, I'm using waitUntilPresent on an element:
webdriver.wait.for.timeout=10000
webdriver.timeouts.implicitlywait=0
This should disable implicit wait and only use explicit wait, as one of the Selenium devs has suggested avoiding mixing both implicit and explicit waits.
However, it looks like waitUntilPresent relies on the implicit wait parameter. With the above settings, my test fails after the first poll (typically at around 100 milliseconds). Is there to force it to use the explicit wait parameter instead? I know I could increase the implicit wait parameter and reset it later, but my concern is that if this test failed before resetting the parameter, the rest of the tests would be subject to the implicit wait, which at ten seconds massively slows down my test suite.
If I was writing the same operation in plain Selenium, I'd use the following:
WebDriver driver = new FirefoxDriver();
WebDriverWait wait = new WebDriverWait(driver, 10);
driver.get(url);
driver.findElement(By.cssSelector("#email")).sendKeys(email);
driver.findElement(By.cssSelector("#password")).sendKeys(password);
driver.findElement(By.cssSelector("input.submit[value='Log in']")).click();
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(".mjHome")));
While I could build a WebDriverWait using getDriver(), I'd need to either repeat the selector (something I'd rather avoid), or refer to the selector from the Page Object, as WebDriverWait doesn't appear to work with WebElementFacade, and I am not aware of an equivalent in Serentiy.
Any thoughts?