When I select all text in "fieldLabel" field

Focuses a form field and selects all of its text, exactly as a user pressing Ctrl+A inside the field would. The field is located with an accessibility-first lookup chain: label text, then placeholder, then a textbox with a matching accessible name, and finally a name attribute or element id. This means "Title" can match a field labelled Title, a field with the placeholder Title, or an input named Title.

A typical use is replacing existing content: select all text, then type new text so the selection is overwritten in one keystroke sequence. The step only creates a selection; it does not modify the value by itself. It works on standard text inputs and textareas.

Accepted phrasings

When I select all text in "<field>" field
When we select all text in "<field>" field
When select all text in "<field>" field

Examples

When I select all text in "Title" field
When I select all text in "Description" field
When I select all text in "Email" field
When I select all text in "Message" field

In a real scenario

Scenario: Replace a draft title by selecting all of it first
  Given I am on "/articles/draft/edit"
  When I fill in "Working title" for "Title"
  And I select all text in "Title" field
  When I fill in "Final release title" for "Title"
  And I press "Save"
  Then I should see "Final release title"

Related steps

Back to Selectors Steps