WebdriverIO Tutorial Home / Video /

Using waitUntil Command in WebdriverIO Tutorial

Using waitUntil Command in WebdriverIO Tutorial

About The Video

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.

Video Chapters

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

Key Topics Covered

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.

Related Blogs/ Hubs/Doc

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

Selenium C# Tutorial on Explicit and Fluent Wait

Get started with a detailed guide to WebdriverIO Tutorial

More Videos from WebdriverIO Tutorial