Block Locator Strategies
Block Locator Strategies help you train Provar to recognize a specific ‘block’ or grouping of elements on a page such as a pop-up dialog box, tab or page section. Block locator strategies are available from Provar version 1.9.8 onwards.
Use the following links to navigate to the relevant section:
- Examples (COMING SOON)
A Block Locator Strategy helps Provar to locate elements accurately on pages where there may be multiple fields of the same name. This helps Provar limit its search to a specific area when trying to locate the field.
A Block Locator Strategy is particularly useful for custom pages, which Provar may not recognize automatically, or for third-party applications on any platform. Once a Block Locator Strategy is defined it can be reused across multiple similar pages to simplify your element locators.
Block Locator Strategies are helpful for:
- Activating tabs to reveal different panels of information
- Expanding or collapsing page sections
- Locating the right field when similar fields are present in different blocks. The same field label might, for example, be present in a pop-up dialog and also on the screen behind the dialog.
Note that while By Label Strategies locate fields and appear in the Field Details section in Test Builder, Block Locator Strategies pertain to the Page Structure section. A new Page Structure entry is typically created for each matched block.
Creating a Block Locator Strategy
Block Locator Strategies are written in Java rather than declaratively through Provar. They can be written from scratch or the Provar Support team can help to provide a Block Locator Strategy file for your use case.
Once a Block Locator Strategy is created, the .java file should be stored under pagestrategies below the src folder. This can be seen in the Navigator below: