Does the Selenium FindBy annotation actually instantiate WebElement instances, and if so, what is the connotation to the framework that uses them?
What I have been doing in my page objects looks like this right now. All my test framework methods take By locators as arguments (not WebElement instances).
//fields in the page
public static final By SEARCH_BOX = By.id("input-what");
My question is, does using FindBy instantiate WebElement instances at the time of class instantiation? If so, then I suspect my framework methods would need to take WebElement instances. Is this correct, and which is preferred in a framework: By locator arguments or WebElement arguments?
@FindBy(id = "input-what")
public WebElement SEARCH_BOX_ELEMENT;
I know I am expecting a somewhat opinionated answer. If you give me a hyperlink citation for your belief, then I think that would be a reasonable answer. I think this has far-reaching implications: for example, the methods in Selenide framework, don't take WebElement instances in their arguments and therefore PageObjects that use FindBy annotations would not be able to pass those elements to Selenide methods?