This step clicks a link or button inside a table row that is identified by a piece of text it contains. The first parameter is the clickable element's label - the text of the button or link you want to activate. The second parameter is the row identifier - any text that uniquely identifies the table row (such as a name, id, or other cell value). The step finds the first tr element whose text contains the row identifier, then looks within that row for a link, button, or submit input whose label exactly matches the operation text. If no such interactive element is found, it falls back to clicking any element with that exact text in the row.
The row identifier is a substring match, while the operation text is exact and case-sensitive. This makes it straightforward to write steps like "click Edit in the row for Order #123" without needing to know the row's position in the table. If two rows contain the same identifying text, only the first one is used. If the clickable element inside the row has no visible label, use a general attribute-based click step instead.
Accepted phrasings
When I click "Edit" in the "John Smith" row
When I click "Delete" in the "Product A" row
When we click "View Details" in the "Order #12345" row
And I click "Download" in the "Report 2024" row
And I click "Edit" in "alice@example.org" row
Examples
When I click "Edit" in the "John Smith" row
When I click "Delete" in the "Product A" row
When we click "View Details" in the "Order #12345" row
And I click "Download" in the "Report 2024" row
In a real scenario
Scenario: Admin views a specific user account from the people list
Given I am on "/admin/people"
When I fill in "alice" for "Name or email contains"
And I press "Filter"
And wait
Then I should see "alice"
When I click "alice" in the "alice" row
And wait
Then I should see "alice's account"
Related steps
- Click link or button by visible text - click without scoping to a table row
- Press button by visible text - press a button by its exact label
- Click link or button by attribute - click using an id, class, or data attribute
- Attach file to input - set a file on a file input element