The selectors.json file allows the user to define CSS or XPath selectors to use to specify which elements of pages/screens to interact with or validate.


	"header1": "css: html > body > table > thead > tr > th:first-child",
	"header2": "xpath: /html/body/table/tbody/tr[1]/th[2]",
    "row1Cell3": "css: html > body > table > tbody > tr > td:nth-child(3)"

Each selector must have a unique name. Selector values must begin with either css: or xpath: to identify which form of selector is being defined.

Using Selectors in Step Defitions

Given the example above and this web page you might be testing:

        <title>Some Web Page</title>
                    <th>Product ID</th>
                    <th>Product Name</th>
                    <th>Product Price</th>
                    <td>Golang for Dummies</td>

The first and second steps below will pass and the third will fail:

Then "header1Css" should contain "Product ID"
And "header2Xpath" should contain "Product Name"
And "row1Cell3" should contain "$40.00"