@FindBy specifies how a Selenium WebElement is located inside a Page Object. With PageFactory, annotations such as @FindBy(id = "name") connect Java fields to HTML elements and keep interaction methods readable. section 7.1.2
Common uses include:
- Generate annotation-based page classes from supplied HTML by stating the required Java, Selenium, PageFactory, and locator constraints. section 7.1.2
Contact form
A ContactFormPage initializes PageFactory and declares @FindBy(id = "name") for nameInput and @FindBy(id = "submitContact") for submitButton; methods then enter values and submit the form.
