Echo Location – Skipping the Page Object Model
So far, we have used the Page Object Model (POM) to encapsulate the UI elements and interactions with a page within an object. We can usually see our target objective clearly with the XPath or CSS locator, but consider the superheroes who get the job done blindly in the dark. While the POM has many merits, there are scenarios where finding objects by text alone, in the dark, based on some clues, can offer advantages:
- Quick prototyping and simplified test creation: For quick and dirty testing or prototyping, it might be overkill to establish a full-fledged POM of thousands of objects. In such cases, directly locating elements can speed up the initial test development process.
- Handling elements with dynamic content: In modern web applications, the content can be highly dynamic. Elements may not have fixed IDs, classes, or other attributes. Text content is often more stable in later releases behind the scenes in the DOM...