When I select from "fromNum" to "toNum" text in "fieldLabel" field

Focuses a form field and selects a character range of its text, from a start index to an end index. Indexes are zero based and follow the standard text-selection convention: from 0 to 5 selects the first five characters, and the character at the end index is not included. 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.

The selection is applied through the field's native selection range, so the step works on standard text inputs and textareas; elements without a selection API (for example rich text editors rendered as contenteditable regions) are silently skipped. The step only creates a selection and moves focus; it does not change the field value. If you know the substring rather than its position, use the sibling step that selects by text instead.

Accepted phrasings

When I select from <from> to <to> text in "<field>" field
When we select from <from> to <to> text in "<field>" field
When select from <from> to <to> text in "<field>" field

Examples

When I select from 0 to 5 text in "Title" field
When I select from 3 to 8 text in "Description" field
When I select from 0 to 20 text in "Notes" field
When we select from 0 to 3 text in "Phone" field

In a real scenario

Scenario: Select the first word of a title before retyping it
  Given I am on "/articles/draft/edit"
  When I fill in "Release 2.0 notes" for "Title"
  And I move focus to "Title" field
  And I select from 0 to 7 text in "Title" field
  When I fill in "Preview 2.0 notes" for "Title"
  And I press "Save"
  Then I should see "Preview 2.0 notes"

Related steps

Back to Selectors Steps