In order to define a new web locator, follow the steps below:
- Click on New while on Web Locators tab:
2. This will open up the New Locator tab as follows:
3. Advanced View of New Locator will switch to editor mode where you can copy the content of the locator and then Grid View takes you back to the above view of new Locator definition
4. On the window in Step 2, specify the Web Page which is an editable drop-down (best practice is to use application name followed by “_” and followed by page name, for example myApp_login, myApp_search, etc.), Type (another editable drop-down), and Alias for the locator you are defining along with only one unique identifier. This identifier can be the Web ID, Name, Partial Text, CSS Selector, or XPath of the widget. If more than one of these values is specified, Subject7 will use the first one that it finds based on the order mentioned above and will ignore the rest.
- If the locator is on a frame, you need to define the frame by using the frame XPath. If you have nested frames, you can include the XPath’s for all the frames separated by “;”
- If the widget is on a popup window, you need to include a text or phrase that uniquely identifies that popup (only exists on that popup)
- If you have XPath specific to each type of browser, you can include that under Advanced section of locator and populate XPath in the IE XPath, Safari XPath, etc. These XPath’s have priority over the general XPath identified. The image below shows the Advanced menu which is concealed by default.
For best results with XPath/CSS, you can use our Smart XPath/CSS Generation Engine to generate your XPath values.
5. Click the Save button to save your locator. Once saved, your newly defined locator will show up in the locator listing on the Web Locators screen. In order to see the relevant elements, you can filter them using Key, Web Page, XPath, CSS Selector, Frame, Owner, State, or Popup.
6. Inject Template will allow you to parametrize any of the locator fields shown above. In order to do this, click on any of the above fields and when the field turns blue, click on Inject Template then select Data Template and Field and click Inject.
Tip
Web Page, Frame and Popup values are saved from one locator definition to the next to make it easier to define locators on the same page.
Tip