Selenium 4 Beginner Tutorial 3 | Waits

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

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

  • @Varun-A
    @Varun-A Год назад

    Your tech teaching style is really effective. I'm learning so much

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

    That is a great playlist of teachings.
    Thank you very much 🙏

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

      You are very welcome Juaz

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

    Thanks raghav , for explaining about different types of waits and explaining fluent wait difference also , thanks a ton !

  • @flirtuall78
    @flirtuall78 5 месяцев назад

    Thank you for sharing another informative session.

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

    another great tutorial! thank u so much Raghav from Ukraine!

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

      Most welcome Ekaterina

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

    Much awaited. ♥️

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

      Thanks for looking forward Asha, next video will come soon

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

    Very useful tutorial, thanks !

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

    Awesome tutorial

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

    Thanks a lot

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

    Thanks a lot Raghav. I hope you'll also cover the Bidi api part. Looking forward to it.

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

    Hope so start soon..👍

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

    Good one Sir👏👏

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

    Thank you

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

    Ragave sir can you make video on how we use JavaScript Executors along with Page Object Model. I tried lots of time but it not getting idea on it.

  • @syedarmaghanhassan4652
    @syedarmaghanhassan4652 10 месяцев назад

    Hi Raghav,
    thanks a lot for teaching.
    Can we store it in a String? I mean the whole line of code: driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
    I want to put it in a variable say waitPlease, so that when i wanna put wait, i don't have to right all the line, but i just write waitPlease;
    or can we make a function out of it? so that we can just write waitPlease(); and then we don*t have to write the whole line?
    is it possible?

    • @RaghavPal
      @RaghavPal  10 месяцев назад

      Syed
      Yes, you can store the whole line of code `driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));` in a String variable, or you can make a function out of it.
      **To store the wait code in a String variable:**
      ```java
      String waitPlease = "driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));";
      ```
      Then, you can use the `waitPlease` variable to wait for elements to be present on the page:
      ```java
      // Wait for the element with the ID "myElement" to be present on the page.
      WebElement element = driver.findElementById("myElement");
      eval(waitPlease);
      element.click();
      ```
      **To make a function out of the wait code:**
      ```java
      public static void waitPlease() {
      driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      }
      ```
      Then, you can call the `waitPlease()` function to wait for elements to be present on the page:
      ```java
      // Wait for the element with the ID "myElement" to be present on the page.
      WebElement element = driver.findElementById("myElement");
      waitPlease();
      element.click();
      ```
      **Which option should you use?**
      Both options are valid, but I recommend using the function option if you are going to be using the wait code multiple times in your test. This will make your code more readable and maintainable.
      Here are some additional tips for using waits in Selenium:
      * Use implicit waits sparingly. Implicit waits can slow down your tests, so it is best to only use them when necessary.
      * Use explicit waits to wait for specific conditions to be met. For example, you can use an explicit wait to wait for an element to be visible, clickable, or enabled.
      * Be careful not to overuse waits. Too many waits can make your tests slow and unreliable.
      I hope this helps

  • @arpitadash7598
    @arpitadash7598 5 месяцев назад

    what's are the changes in wait statement for selenium 4 and 3?

    • @RaghavPal
      @RaghavPal  5 месяцев назад

      Arpita
      In Selenium 4, there are changes in the wait statements compared to Selenium 3. Here's a summary:
      1. Implicit Wait:
      - Selenium 3:
      ```java
      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      ```
      - Selenium 4 (deprecated):
      ```java
      driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
      ```
      2. Explicit Wait (WebDriverWait):
      - Selenium 3:
      ```java
      WebDriverWait wait = new WebDriverWait(driver, 10);
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".classlocator")));
      ```
      - Selenium 4:
      ```java
      WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
      wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".classlocator")));
      ```
      3. Fluent Wait:
      - Selenium 3:
      ```java
      Wait wait = new FluentWait(driver)
      .withTimeout(30, TimeUnit.SECONDS)
      .pollingEvery(5, TimeUnit.SECONDS)
      .ignoring(NoSuchElementException.class);
      ```
      - Selenium 4:
      ```java
      Wait fluentWait = new FluentWait(driver)
      .withTimeout(Duration.ofSeconds(30))
      .pollingEvery(Duration.ofSeconds(5))
      .ignoring(NoSuchElementException.class);
      ```
      Remember to adapt your existing code to these changes when migrating to Selenium 4.
      ..

    • @arpitadash7598
      @arpitadash7598 5 месяцев назад

      @@RaghavPal thank you so much Sir

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

    Hello Mr. Raghav, would you guide me. How to change http port tp https port for Jenkins?

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

      Hi Eko, not sure on this

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

      @@RaghavPal alright thx Mr raghav, because i have problem here

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

      If I find something useful will share with you

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

    Ragav.
    Is there anyway to convert .xlsb to .xlsx using Apache poi

  • @andrey-Green
    @andrey-Green 2 года назад

    don't mix explicit and implicit waits

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

      Yes, or use them with the wait time calculated