Closed bzsharm closed 3 years ago
This is expected behaviour. You need to put withTimeoutOf() BEFORE the element variable, otherwise the timeout will be applied the first time the variable is used, ie before withTimeoutOf is called.
WebElementFacade elem ;
elem.withTimeoutOf(Duration.of(timeout, SECONDS))
Something like this right?
I used it in the same way that you advised , this is how the method looks
**public void waitUntilElementContainsText(WebElementFacade elem, String strTxt,int timeout){
elem.withTimeoutOf(Duration.of(timeout, SECONDS)).shouldNotContainText(strTxt);
}**
@wakaleo any thoughts
withTimeoutOf(Duration.of(timeout, SECONDS))...
It only applies to operations following the "withTimeoutOf(), not the object itself.
thanks for your response @wakaleo My Intention here is to make the "element wait till it contains the particular String / Text". (WebElementFacade) ! Please advise
withTimeoutOf(Duration.ofSeconds(10)).waitFor(ExpectedConditions.textToBe(By.cssSelector("#my-element"), "Expected Text"));
@wakaleo thanks for the response John !
Error Description:- "timeout" not working "withTimeoutOf(Duration.of(timeout, SECONDS))" for shouldNotContainText() and shouldContainText();
While using "withTimeoutOf(Duration.of(timeout, SECONDS))" for method "shouldNotContainText(String)/shouldContainText(String)" ,"timeout" duration is getting overridden by webdriver.wait.for.timeout = 30000 from the serenity.properties file instead of "timeout" parsed in the custom method created .
Version Details:-