In this part 4 of the WebdriverIO tutorial series, join 𝐌𝐚𝐫𝐜𝐨 𝐀 𝐂𝐫𝐮𝐳, founder of automateNow, as he explores waits and synchronization. Join him in exploring the waitUntil command, understanding its usage, and mastering custom timeouts while creating personalized functions.
By the end of this tutorial, you'll have a comprehensive understanding of the waitUntil command, equipped with best practices for efficient test automation.
00:00 Intro
00:33 What is waitUntil command?
01:10 How to use waitUntil command
05:50 Wait for dynamic elements
10:45 Custom timeouts
13:05 Creating custom functions
14:20 Best practices
15:45 Outro
Introduction to WebdriverIO's Wait Until Command: Marco introduces the waitUntil command, describing it as the "universal weapon" for waiting on specific conditions in automated tests. He explains that this command allows for greater flexibility in tests by waiting for specific conditions to be met before proceeding.
Understanding Wait Until Command Syntax: The syntax and usage of the waitUntil command are explained, highlighting how to wait for various conditions such as an element to contain certain text. Marco also discusses the option to specify additional parameters like timeout, timeout message, and interval for the wait.
Automating Scenarios Using Wait Until: The video walks through automating a scenario on the LambdaTest playground website, where the waitUntil command is used to wait for a specific element ('Printers' title) to appear after selecting an option from a dropdown menu.
Custom Waits Creation: Marco demonstrates how to use the waitUntil command to create custom wait conditions, providing flexibility in handling elements that may take variable amounts of time to become available or change state.
Implementing Async and Await: The necessity of using async and await keywords with the waitUntil command is emphasized to ensure tests execute commands sequentially and wait appropriately for conditions to be met.
Customizing Timeout Parameters: The video shows how to customize the wait conditions further by adjusting the timeout period, adding custom timeout messages, and setting the interval at which the condition is checked.
Dealing with Dynamic Elements: Marco covers strategies for handling dynamic elements that may not be immediately present or that may change state in response to user actions, using the waitUntil command to ensure the test waits for these elements to reach the desired state.
Creating Reusable Functions for Waits: Towards the end, Marco illustrates how to encapsulate wait logic into reusable functions, making the test code cleaner and more modular.
Tips and Best Practices: The video concludes with tips for effectively using the waitUntil command, including a recommendation to use regular functions instead of arrow functions when dealing with the this keyword within wait conditions.
Selenium WebdriverIO Tutorial with Example
WebdriverIO Tutorial For Handling Dropdown In Selenium
WebdriverIO Tutorial: Run Your First Automation Script
WebdriverIO Tutorial: Handling Alerts & Overlay In Selenium
Marco A Cruz
Marco, the founder of automateNow, distinguished as an international conference speaker, coach, influencer, YouTuber, and blogger. With a heart rooted in engineering, Marco harbors a profound passion for software testing, dedicating over a decade to the field. His journey has equipped him with valuable insights, which he enthusiastically shares with the world. Marco's mission is to empower aspiring engineers, aiming to help them realize their dreams through his wealth of knowledge and experience.