What is Fluent Wait in Selenium WebDriver? (Interview Question #16)

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 23

  • @miral-mamun6145
    @miral-mamun6145 2 года назад +1

    Class WebDriverWait is a disciplined child (Specialization) of Class
    FluentWait and grand child of interface Wait. In short, Class
    FluentWait implements Wait interface and WebDriverWait extends
    FluentWait.
    So there are many things common in WebDriverWait and FluentWait
    instances such as :-
    You can set polling interval in both instances.
    You can ignore any exceptions in both instances.
    You can use ExpectedConditions methods in both instances.
    You can override apply() method in both instances.
    If they are common then why WebDriverWait is given?
    We could have used FluentWait itself.
    But the major difference between them is that WebDriverWait is a
    specialization of FluentWait which uses WebDriver instance and
    this class have added specific mechanism related to WebDriver.
    That's why it ignores instances of NotFoundException by default.
    In case of FluentWait, If you need to ignore any exception
    in FluentWait instance, you need to mention it explicitly.

  • @sunil100r
    @sunil100r 2 года назад +1

    This is the best explanation of Webdriver wait and Fluent wait that I have seen.
    One question is polling 7 or 4 times it doesn't matter right but finally it's waiting for 3 seconds. What is the difference?

    • @QAFox
      @QAFox  2 года назад +1

      Fluent Wait is an advanced version of Webdriver Wait, which provides an extra customization in polling time. Other than that there is no difference. In real time, hence we use WebDriver Wait for explicit wait.

  • @shankarprasad2454
    @shankarprasad2454 3 года назад +4

    Excellent simple and precise!

    • @QAFox
      @QAFox  3 года назад

      Thank you :)

  • @pujasaha5452
    @pujasaha5452 3 года назад +3

    Best explanation ..great work 👌

    • @QAFox
      @QAFox  3 года назад

      Thank you :)

  • @reshmapn7941
    @reshmapn7941 3 года назад +2

    It's very clear and concise explanation sir
    Thank you

    • @QAFox
      @QAFox  3 года назад

      Welcome Reshma :)

  • @miral-mamun6145
    @miral-mamun6145 2 года назад

    WebDriverWait is a ready to use class for WebDriver.
    WebDriverWait can not be used for a non-selenium
    waiting condition while FluentWait can be used.

  • @swapnil3835
    @swapnil3835 2 года назад +1

    Explanation is awesome ...
    Thank u sir

    • @QAFox
      @QAFox  2 года назад

      Welcome :)

  • @anygamer2792
    @anygamer2792 2 года назад

    Sir how we can write fluent wait for framework level
    Eg, where ever required fluent wait we can simply call that function. Can you tell. Me how to do that?

  • @miral-mamun6145
    @miral-mamun6145 2 года назад

    FluentWait allows to set polling interval while WebDriverWait
    does not. Fact - You can set in both after all WebDriverWait
    extends FluentWait and all configurable methods are public in
    FluentWait.
    We can not use conditions defined in class ExpectedConditions
    in FluentWait instance and override apply method in WebDriverWait
    instance. Fact - You can use any one in any instance.
    WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
    // Check for condition in every 2 seconds and overriding default interval 500 MS
    wait.pollingEvery(Duration.ofSeconds(2));

  • @kiranbarhate2118
    @kiranbarhate2118 Год назад +1

    Where to find the interview question and answer notes

    • @QAFox
      @QAFox  Год назад

      In the description of the videos.

  • @udayshankar385
    @udayshankar385 2 года назад +1

    Your Explanation is good ! but you know even you can override default polling time of WebdriverWait. like this:
    WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
    wait.pollingEvery(Duration.ofSeconds(2));
    because at 14:29 you said that you can not customize default polling time of WebDriverWait, which is not true .

    • @QAFox
      @QAFox  2 года назад

      Earlier while recording the video, I didn't know that. But later I got to know. Will create a video on this soon.

    • @udayshankar385
      @udayshankar385 2 года назад +1

      @@QAFox Thank you!

    • @QAFox
      @QAFox  2 года назад

      @@udayshankar385 Welcome :)

  • @sasireka7974
    @sasireka7974 2 года назад +1

    Sir,mostly in our project which wait is used fluent or explicit

    • @QAFox
      @QAFox  2 года назад

      Explicit WebDriverWait is used in projects.

  • @revathikamaraj6650
    @revathikamaraj6650 Год назад

    These 2 lines are not working in selenium 4.11.0
    WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(10));
    FluentWait wait = new FluentWait(driver).withTimeout(Duration.ofSeconds(35)).pollingEvery(Duration.ofSeconds(10));
    and also,
    wait.until(ExpectedConditions.visibilityOf(e));
    Can anyone help me to handle this? Please