TestNG Tutorial With Selenium | How To Handle Dynamic Waits In Selenium⏳| Part-VII | LambdaTest
In this full TestNG tutorial for beginners, Rex Jones (@RexJonesII), a seasoned QA Engineer, Trainer, YouTuber, and Blogger, walks you through the TestNG framework and everything you need to know to get started with Selenium automation testing. This video also covers TestNG valuable features like grouping, dependence, prioritization, ease of using multiple annotations, etc.
0:00 Introduction to Dynamic Wait Statements
0:46 Different Selenium Wait Methods
2:22 What is Explicit Wait?
12:46 What is Fluent Wait?
24:04 What is Implicit Wait?
34:08 Conclusion
Introduction to Dynamic Wait Statements: The video starts with an explanation of why dynamic wait statements are crucial for testing web applications with dynamic content. It distinguishes dynamic waits from the inefficient Thread.sleep() method, emphasizing the importance of waiting for specific conditions rather than a fixed time.
Types of Dynamic Wait Statements in Selenium:
Page Load Timeout: Sets the maximum time for a page to load before throwing an exception.
Script Timeout: Determines the time allowed for a script to execute.
Implicit Wait: Configures the WebDriver to wait for a certain amount of time when trying to find an element if it's not immediately available.
Explicit Wait: Waits for a certain condition to occur before proceeding with the execution.
Fluent Wait: Allows more complex configurations, specifying the maximum amount of time to wait for a condition and the frequency with which to check the condition. It also allows ignoring specific types of exceptions while waiting.
Practical Demonstrations:
The tutorial includes demonstrations of three key wait strategies: Explicit Wait, Fluent Wait, and Implicit Wait. For Explicit Wait, an example is provided where the test waits for a dynamically loaded image to be displayed after clicking a button.
The Fluent Wait demonstration shows how to poll for a condition (such as the completion of a download progress) and print the progress percentage dynamically.
The Implicit Wait example illustrates how to set a global wait time that applies to all element searches, using a scenario where the test waits for a "Hello World" message to be visible after initiating a dynamic action.
Code Implementation: The video walks through the code implementation for each wait strategy, including setting up the WebDriver, navigating to the test page, finding elements, and applying the wait statements. It also shows how to use assertions to validate that the expected conditions are met.
Best Practices and Tips: Throughout the tutorial, best practices are highlighted, such as avoiding the combination of implicit and explicit waits due to potential unexpected wait times and ensuring that wait statements are appropriately used to improve test reliability and efficiency.
Selenium Waits Tutorial: Guide to Implicit, Explicit, and Fluent Waits
Selenium C# Tutorial on Explicit and Fluent Wait
Rex Jones
Rex is an Experienced Quality Assurance (QA) Engineer with a history of working in the IT and Services industry. Certified as a Certified Software Test Engineer (CSTE) and Test Management Approach (TMap). Also skilled in Automation, Agile Methodologies, Test Strategies, and Software Development Life Cycle (SDLC) with a passion for testing software manually or automation such as Selenium.
TestNG Tutorial With Selenium | How To Perform Geolocation Testing 📍| Part-XI
TestNG Testing TutorialTestNG Tutorial With Selenium | How To Perform Cross Browser Testing 👨💻| Part-X
TestNG Testing TutorialTestNG Tutorial With Selenium | How To Do Parallel Testing In TestNG 📃| Part-IX
TestNG Testing TutorialTestNG Tutorial With Selenium | How To Handle Dynamic Waits In Selenium ⏳| Part-VII
TestNG Testing TutorialTestNG Tutorial With Selenium | Capturing Screenshot Of Failed Tests | Part-VI
TestNG Testing Tutorial