WebdriverIO Tutorial Home / Video /

How to Use Assertions in WebdriverIO

How to Use Assertions in WebdriverIO

About The Video

In Part 11 of the WebdriverIO series, join 𝐌𝐚𝐫𝐜𝐨 𝐀 𝐂𝐫𝐮𝐳, founder of AutomateNow, as he explores the importance of assertions in test automation. Discover how to verify functionality, catch bugs, improve reliability, and prevent false positives using powerful assertion techniques in WebdriverIO.

Video Chapters

00:00 - Introduction

00:53 - Why Assertions are Important

02:42 - Common Assertions

03:32 - Using toHaveUrl Assertion

05:57 - Using toHaveTitle Assertion

08:04 - Using toBeClickable Assertion

09:15 - Using toBeDisplayed Assertion

11:19 - Using toBeEnabled Assertion

14:02 - Using toBeDisabled Assertion

16:23 - Using toHaveValue Assertion

18:09 - Using toHaveText Assertion

19:24 - Using toHaveAttribute Assertion

20:42 - Using toHaveElementClass Assertion

22:11 - Using toHaveChildren Assertion

22:57 - Using toBeChecked Assertion

25:14 - Conclusion

Key Topics Covered

Introduction to Assertions: The video starts with an introduction to assertions in WebdriverIO and explains why they are important. Assertions are crucial for ensuring that tests verify functionality and help in catching bugs early.

** Why Assertions Matter:** Assertions are used to verify the correctness of tests, ensuring quality, improving test reliability, and preventing false positives. The video emphasizes their role in ensuring a high-quality product.

Common Assertions in WebdriverIO: The tutorial lists some of the common assertions available in WebdriverIO, such as checking URLs, titles, button clickability, and text verification. These assertions help validate elements on a webpage.

How to Use Assertions: The video goes through practical examples, showing how to implement different assertions in WebdriverIO, such as verifying the presence of elements, checking URLs, and validating buttons.

Text and Attribute Assertions: Examples are provided on how to verify text within elements, check if a checkbox is checked, and how to validate the attributes of elements (like checking for specific classes or IDs).

Interactive Testing with WebdriverIO: The video includes a practical example using LambdaTest to demonstrate how assertions are used to check real-world scenarios, including verifying that buttons are clickable and input fields have expected values.

Handling Disabled Elements: The tutorial also shows how to handle disabled elements and check for their correct state, such as disabled checkboxes or input fields.

Related Blogs & Hubs

A Detailed Guide to WebdriverIO Assertions

More Videos from WebdriverIO Tutorial