Questions tagged [fluentwait]

FluentWait

FluentWait is one of the implementation of the Selenium's Wait interface through which user can confugre custom/tailor-made timeouts and polling intervals runtime.

Through FluentWait instance users can define the maximum amount of time to wait for a condition through a custom frequency to check the condition. The user can also configure the wait instance to ignore specific exceptions while waiting such as NoSuchElementExceptions when searching for an element on the page.

Sample Usage

// Waiting 30 seconds for an element to be present on the page, checking
// for its presence once every 5 seconds.
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
    .withTimeout(Duration.ofSeconds(100))
    .pollingEvery(Duration.ofMillis(600))
    .ignoring(NoSuchElementException.class);

WebElement foo = wait.until(new Function<WebDriver, WebElement>() {
    public WebElement apply(WebDriver driver) {
        return driver.findElement(By.name("q"));
    }
});

Reference

Class FluentWait

29 questions
10
votes
4 answers

How to remove deprecation warning on timeout and polling in Selenium Java Client v3.11.0

Below is my code which is showing as deprecated after I have been updated the Selenium Webdriver version to 3.11.0. private Wait mFluentWait(WebDriver pDriver) { Wait gWait = new…
kripindas
  • 480
  • 2
  • 7
  • 21
4
votes
4 answers

Handle the NoSuchElementException in Fluent Wait

I know that in terms of waiting for web element that isn't in the DOM yet, the most efficient is a fluent wait. So my question is: Is there a way to handle and catch the NoSuchElementException or any exception that fluent wait might throw because…
2
votes
2 answers

What is the difference between using lambda function in FluentWait usage and not using it?

The wait for an element can be coded as WebElement foo = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("foo"))); In the docs of the FluentWait, an example as given below excluding the definitions of the timeout, polling interval,…
learningQA
  • 641
  • 1
  • 5
  • 20
1
vote
1 answer

Are there potential drawbacks of ultra short polling duration in Fluent Wait in Selenium?

When using FluentWait in Selenium, it is possible to configure the polling duration of the FluentWait As far as I know, that is the frequency of checking if the element exists, for example So, if the timeout is 3 seconds, and the polling duration…
1
vote
1 answer

What is the default wait time of the selenium webdriver before throwing NoSuchElementException

There are 3 types of waits in sellenium i.e Implicit Wait,Explicit Wait and Fluent wait. If i don't use any of the waits,How much time does the selenium waits by default before throwing NoSuchElementException. Is it the Implicit Wait used…
1
vote
1 answer

Wait to perform two actions - selenium/ java

I'm trying to use Fluent wait to perform two actions as below: Click on search button Check the result for the element Right now I'm trying with the below code and it doesn't seem to work: public SendMailPage waitForSometime() throws…
1
vote
2 answers

How to use built-in ExpectedConditions with FluentWait?

In Selenium (Java), I want to use ExpectedConditions with FluentWait. I am trying out following code which is not working. It is not waiting for the element to appear in the DOM. Could someone please help here ? Wait wait = new…
omk
  • 43
  • 1
  • 6
1
vote
3 answers

Implicit vs Explicit vs Fluent Wait

What is difference in between Implicit, Explicit, Fluent Wait ? If we set 10 seconds in Implicit wait and before 10 seconds, within 3 seconds only element get located. That time what will happen ? It will wait for 10 seconds or proceed further.
1
vote
6 answers

The type FluentWait is not generic; it cannot be parameterized with arguments error for FluentWait Class through Selenium and Java

I am working with Selenium Standalone Server 3.0.1. I am trying to add an Explicit Wait to my code to detect an element through xpath when the element becomes visible. In order to get some Java help I looked out for the source code for Selenium…
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0
votes
0 answers

Why do some of my Selenium test scripts fail when run in Suite using TestNG.xml file despite working individually?

I have create more than 200 test-scripts in selenium using TestNg. These scripts run fine if executed individually, but if I try to run those multiple test-scripts in Suite using testNg.xml file in sequential manner, some of the test cases fails…
0
votes
2 answers

How to click on a button until an element appears on a page in selenium

I have a page with a dynamic table that periodically updates with new data. What I am trying to do is to click on a button and reload the page let's say every 3 seconds until the element from that table appears. I know the xpath of the element I…
0
votes
1 answer

"element not interactable" - ElementNotInteractableException is not ignored by FluentWait in Java using Selenium and BrowserStack

I have a class as follows: public class Utils { static WebElement fluentWaiter(final By locator,final WebDriver driver) { Wait wait = new FluentWait(driver) .withTimeout(Duration.ofSeconds(30L)) …
Przemo
  • 193
  • 2
  • 16
0
votes
1 answer

Duration cannot be resolved or is not a field in WebDriverwait in Selenium

I am trying to interact with a calendar on a webpage, so I am using WebDriver wait. Below is the method: new WebDriverWait(driver,Duration.ofSeconds(5)).until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className("calendar"))); Is…
Vidhya
  • 79
  • 2
  • 6
0
votes
1 answer

spring cucumber Selenium fluent wait gives me driver=null

I am trying to use fluent wait @Component @Scope(SCOPE_CUCUMBER_GLUE) public class UserCreationPageImpl extends BaseBinariosPage implements UserCreationPage { Wait wait = new FluentWait( driver ) …
0
votes
3 answers

I want to return void using Fluent wait, how to do that?

I am using Fluent wait. I want to return void instead of Web Element or Boolean. How can I do it? I have tried like this. Code snippet is below Wait wait = new FluentWait(driver).withTimeout(Duration.ofSeconds(30)) …
1
2