Creating an object map for Selenium tests
So far, we have seen how the Selenium WebDriver API needs locator information to find the elements on the page. When a large suite of tests is created, a lot of locator information is duplicated in the test code. It becomes difficult to manage locator details when the number of tests increases. If any changes happen in the element locator, we need to find all the tests that use this locator and update these tests. This becomes a maintenance nightmare.
One way to overcome this problem is to use page objects and create a repository of pages as reusable classes.
There is another way to overcome this problem—by using an object map. An object or a UI map is a mechanism that stores all the locators for a test ...
Get Selenium Testing Tools Cookbook - Second Edition 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.