Reputation: 495
public static <T> T initElements(WebDriver driver, java.lang.Class<T> pageClassToProxy)
within each method which navigates to the target webpage class page ?Or
public static <T> T initElements(WebDriver driver, java.lang.Class<T> pageClassToProxy)
in the constructor of the webpage class?Upvotes: 0
Views: 157
Reputation: 3248
The way it's intended to be is to place your call to PageFactory.InitElements()
in the constructor of the class representing the web page. If you have classes representing a certain object on the page (like header or footer, that occur on several pages), you can call it there, too. The object doesn't have to be a webpage.
Upvotes: 1