How FindBy Works in Selenium?

Timothy Joseph | August 16, 2021

How FindBy Works in Selenium?The @FindBy explanation is utilized in Selenium Page Objects mechanization tests to indicate the area for a WebElement or a rundown of WebElements.

Utilizing the PageFactory, these WebElements are generally instated when a Page Object is made and can be used to find web components that utilize various methodologies like ID, XPath and CSSelector.

There are two different ways to utilize this comment:

1. Start by indicating both 'How' and 'Utilizing' under FindBy comment.

@FindBy(how = How.ID, utilizing = "elementID")

WebElement username;

2. By directly utilizing a finder like id, XPath, ClassName, partialLinkText, tagName or name.


WebElement username;

The above comments are broadly utilized in test structures made via computerization testing organizations. If you want professional assistance in using Selenium webdriver, contact QASource today 


This publication is for informational purposes only, and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.

Post a Comment