This chrome extension helps to determine unique Selenium WebElement @FindBy tags that can be used with a PageFactory to initialize elements on a web page. It listens for user clicks on a web page to generate unique selectors for the click's source element and suggests the best method to find that element in a page model annotation like below:
@FindBy(id=”addButton”)
public WebElement addButton;
The extension processes the clicked element to determine the following selectors for that specific element:
- ID
- Name
- ClassName
- CSS
- Xpath
Once those have been determined, it selects the best available unique option for selection based on the rankings above and prints the results to the console. The specifc @FindBy tag is also copied directly to the clipboard.
#Setup
- Download and unzip.
- Open Google Chrome and navigate to chrome://extensions.
- Click the "Developer mode" check box.
- Click "Load unpacked extension..." and point it to the unzipped folder.
- The icon has now been added to your browser bar. Click it to turn on the selector.
- Right click on the page you are inspecting and select "Inspect". Open the console tab.
- Click away!