What does PageFactory.initElements do?
QuizMediumJava onlyAsked in: Infosys, TCS, Wipro
A page class has the field @FindBy(id = "username") private WebElement user;. What does PageFactory.initElements(driver, this) do to it?
- It sets each annotated field to a proxy that finds the element when a method is called on it
- It finds every element straight away and fails if any is missing
- It waits until every element is visible
- Nothing: @FindBy fields fill themselves
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.