5

Alter Egos – The ClickAdv Wrapper

In this and the next few chapters, we will introduce the concept of adding wrappers for the.click(), .select(), and .setValue() intrinsic methods. These wrappers allow us to add more functionality to these methods to make the framework more robust and less likely to fail during a test.

Wrappers are the easiest way to extend functionality throughout the test suite, eliminating the need to repeatedly add code in the form of multiple test scripts. Sometimes when testing, the page loads slowly and our elements take longer to load. Sometimes, the page is updated due to Asynchronous JavaScript and XML (AJAX) and the element we found is now stale and must be found again. Our results, shown in both the console window ...

Get Enhanced Test Automation with WebdriverIO now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.