Register a named XPath selector at runtime.
Step pattern
When (I |we )*add "([^"]*)" selector for "([^"]*)" xpath selectorExamples
Example #1
When I add "page title" selector for "//h1[contains(@class,'page-header')]" xpath selectorExample #2
When I add "Dashboard" selector for "//*[@id='navbar-link-admin-dashboard']" xpath selectorExample #3
When I add "Vertical orientation" selector for "//*[@id='navbar-item--2-tray']/div/div[2]/div/button" xpath selectorExample #4
When I add "admin menu" selector for "//nav[contains(@class,'admin-menu')]" xpath selectorExample #5
When I add "first table row" selector for "//table/tbody/tr[1]" xpath selectorExample #6
When I add "active tab" selector for "//li[contains(@class,'active')]/a" xpath selectorExample #7
When I add "error message" selector for "//*[contains(@class,'error')]" xpath selectorExample #8
When I add "site name" selector for "//a[contains(@class,'site-name')]" xpath selectorExample #9
When I add "user menu" selector for "//*[@id='user-menu']" xpath selectorExample #10
When I add "language switcher" selector for "//ul[contains(@class,'language-switcher')]" xpath selectorExample #11
Axis predicates — first match only (locator.first() is applied):
When I add "first row" selector for "//table//tr[1]" xpath selectorExample #12
Text contains — name by rendered label:
When I add "login link" selector for "//a[contains(normalize-space(.),'Login')]" xpath selectorExample #13
Attribute + position — last nav item:
When I add "last nav item" selector for "//nav[@role='navigation']//a[last()]" xpath selector