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 and Allure, should be detailed enough to indicate what is occurring. Wrappers allow us to start handling all that information efficiently, including scrolling an element into view for screen captures, looking for similar replacement...