Identifying some WebElements on the fly

In all the PageObjects, we have initialized the elements that we are going to use during object instantiation, using the @FindBy annotation. It is always good to identify all the elements of a page that are required to accomplish a User Service and assign them to the member variables in your PageObject. However, it is not always possible to do that. For example, if you want to edit a particular post in the All Posts page, it is not mandatory, during PageObject initialization, to map each post on the page to a member variable in your PageObject. When you have a large number of posts, your PageObject initialization will be spending unnecessary time mapping the posts to your member variables, even though ...

Get Selenium WebDriver 3 Practical Guide - 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.