Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Enhanced Test Automation with WebdriverIO

You're reading from   Enhanced Test Automation with WebdriverIO Unlock the superpowers of hybrid testing frameworks

Arrow left icon
Product type Paperback
Published in Nov 2023
Publisher Packt
ISBN-13 9781837630189
Length 328 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Larry C. Goddard Larry C. Goddard
Author Profile Icon Larry C. Goddard
Larry C. Goddard
Paul M. Grossman Paul M. Grossman
Author Profile Icon Paul M. Grossman
Paul M. Grossman
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Chapter 1: The Utility Belt – Tools Every Superhero SDET Needs 2. Chapter 2: Fortress of Solitude – Configuring WebdriverIO FREE CHAPTER 3. Chapter 3: Cybernetic Enhancements – WebdriverIO Config and Debug Tips 4. Chapter 4: Super Speed – Time-Travel Paradoxes and Broken Promises 5. Chapter 5: Alter Egos – The ClickAdv Wrapper 6. Chapter 6: The setValue Wrapper – Entering Text and Dynamic Data Replacement 7. Chapter 7: The Select Wrapper – Choosing Values in Lists and Comboboxes 8. Chapter 8: The Assert Wrapper – the Importance of Embedded Details 9. Chapter 9: The Ancient Spell Book – Building the Page Object Model 10. Chapter 10: Increased Flexibility – Writing Robust Selectors and Reducing Maintenance 11. Chapter 11: Echo Location – Skipping the Page Object Model 12. Chapter 12: Superhero Landing – Setting Up Flexible Navigation Options 13. Chapter 13: The Multiverses – Cross-Browser Testing and Cross-Environment Testing 14. Chapter 14: The Time-Traveler’s Dilemma – State-Driven End to End User Journeys 15. Chapter 15: The Sentient Cape – Running Tests in a CI/CD Pipeline with Jenkins and LambdaTest 16. Epilogue
17. Index 18. Other Books You May Enjoy Appendix: The Ultimate Guide to TypeScript Error Messages, Causes, and Solutions

Writing an XPath element that contains a textual substring

By adding contains() to the selector, the object can be found with just a small part of the text:

//a[contains(text(),'Next']

This works for many elements, but checkboxes and radio buttons are tricky.

Finding an element relative to another element

In this next example, we want to click the checkbox next to the name John Smith. We have several checkboxes but none has a unique identifier by name:

Figure 10.4 – The name John Smith and its associated checkbox are two separate elements

Figure 10.4 – The name John Smith and its associated checkbox are two separate elements

This selector will identify all the checkboxes:

//input[contains(@name,'chkSelect')]

To locate this checkbox element, we need to use the link and find the input checkbox preceding it. Here’s how we can do that:

//a[normalize-space()='John.Smith']//preceding::input[@id='ohrmList_chkSelectRecord_2']

Case-insensitive partial matches

What if we...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime