Welcome to the POMBuilder wiki!
This wiki contains documentation of POMBuilder. You can add this extension to Chrome here.
View, Copy and Paste Your Locator on the POM Builder Tab
- Right click on the element of interest
- Chrome DevTools opens up
- Under the
Elementstab, select the
POM Buildertab (usually the last tab)
- You can click directly on the DOM tree or use the
Identifypointer of Chrome DevTools to select your desired element
Smart Gen recommends the best locators for the selected element on the
- Click the
Copybutton right after a locator to copy its value
- Click the
Findbutton right after a locator to test it using Locator Test
- If you see that Locator Test returns 1/1 (the locator uniquely identifies the element), you're safe to use that locator. Copy it to the corresponding page object of your test project (Protractor, Selenium and TestArchitect).
- If Locator Test returns 0/0 or 1/X (the locator doesn't retrieve any element or the locator points to multiple elements), you must refine the locator until it returns 1/1
- Right-click on the element of interest
POM Builder – Quick Copy> ** There are 3 available selections: *** Suggested Locator: the most reliable locator that is recommended by POM Builder, you should use it for better performance and stability. It could be a single attribute, a CSS Selector or an XPath locator. *** CSS Selector: the CSS Selector that could uniquely identifies the selected element *** XPath: the XPath locator that could uniquely identifies the selected element
- After select your desired selector, the selected locator will be saved in the clipboard
- Feel free to paste it anywhere you want
Define New Output Templates
Currently, POM Builder supports 4 types of output:
- Raw Value: the raw value of the element locator
- Protractor: the locator template written in Typescript for Protractor projects
- Selenium Java: the locator in the typical Java syntax used to locate elements in Selenium
- TestArchitect: the interface elements used in TestArchitect
If you are using another test framework which has a different syntax, you could add a new output template, e.g.
driver.findElement(webdriver.By.%type(%value)) in which
%value are the macros for the locator type ('Id') and its value ('someID') respectively. Remember to put them in your template for a valid locator output.
To save time, you could take advantage of POM Builder Template Configuration feature to define your customized output template.
POM Buildertab in Chrome DevTools
Click the button
Template Configuration, click
Create a new output template named
Selenium JSwith the following information. Note that
%typeis the macro for the locator type and
%valueis the macro for the output value.
Example Resultvalue to check whether your defined output is valid then click
Applyto save the new template
Selenium JSwill appear in the Output dropdown list.
- Select it then copy a locator. The locator will be copied to clipboard in your pre-defined template.
- When you paste it to any editor, you'll see something like the below.