Answer the question
In order to leave comments, you need to log in
How to properly slow down the condition check when moving to another page?
@Then("^переход на \"([^\"]*)\"$")
public void shouldBe(final String shouldBeUrl){
WebDriverWait waitForOne = new WebDriverWait(driver, 10);
waitForOne.until(ExpectedConditions.urlToBe(shouldBeUrl));
}
driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
Answer the question
In order to leave comments, you need to log in
Move wait into a separate function that takes a driver and a target element as input.
The function in a loop with a minimum timeout checks the target element for presence\visibility\clickability, as soon as it finds it, it returns true.
From above, screw the maximum timeout so that it does not fall into an endless loop and voila.
You have a wait that waits just long enough for the target element to appear.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question