This step prints every currently registered XPath selector to the test runner's console output. It is a synchronous debug utility that does not interact with the page or perform any assertion. Each entry is printed on its own line in the format "name": xpath-string, preceded by a --- XPath Selectors --- header.
Use this alongside Then I print css selectors when debugging failures in scenarios that mix CSS and XPath registrations. Because resolution checks the CSS registry first, inspecting both registries helps confirm which entry will win when both registries share a name. The step accepts any Gherkin keyword and both I and we pronouns, making it safe to insert anywhere without disturbing Gherkin grammar.
Accepted phrasings
Then I print xpath selectors
Then we print xpath selectors
When I print xpath selectors
When we print xpath selectors
Given I print xpath selectors
And I print xpath selectors
But I print xpath selectors
Then print xpath selectors
Examples
Then I print xpath selectors
When we print xpath selectors
And I print xpath selectors
Given print xpath selectors
In a real scenario
Scenario: Debug XPath registry when a position check fails
Given I navigate to "https://example.org/articles"
And I define xpath selectors:
| first heading | //h1[1] |
| first subline | //h3[1] |
| active tab | //li[contains(@class,'active')]/a |
Then I print xpath selectors
And I see first heading above first subline