diff --git a/lib/capybara/node/actions.rb b/lib/capybara/node/actions.rb index d0f308aaf..89d3b9100 100644 --- a/lib/capybara/node/actions.rb +++ b/lib/capybara/node/actions.rb @@ -61,7 +61,7 @@ def click_button(locator = nil, **options) ## # # Locate a text field or text area and fill it in with the given text. - # The field can be found via its name, id, {Capybara.configure test_id} attribute, or label text. + # The field can be found via its name, id, {Capybara.configure test_id} attribute, placeholder, or label text. # If no locator is provided this will operate on self or a descendant. # # # will fill in a descendant fillable field with name, id, or label text matching 'Name' @@ -98,8 +98,8 @@ def fill_in(locator = nil, with:, currently_with: nil, fill_options: {}, **find_ ## # # Find a descendant radio button and mark it as checked. The radio button can be found - # via name, id or label text. If no locator is provided this will match against self or - # a descendant. + # via name, id, {Capybara.configure test_id} attribute or label text. If no locator is + # provided this will match against self or a descendant. # # # will choose a descendant radio button with a name, id, or label text matching 'Male' # page.choose('Male') @@ -125,8 +125,8 @@ def choose(locator = nil, **options) ## # # Find a descendant check box and mark it as checked. The check box can be found - # via name, id or label text. If no locator is provided this will match against - # self or a descendant. + # via name, id, {Capybara.configure test_id} attribute, or label text. If no locator + # is provided this will match against self or a descendant. # # # will check a descendant checkbox with a name, id, or label text matching 'German' # page.check('German') @@ -153,8 +153,8 @@ def check(locator = nil, **options) ## # # Find a descendant check box and uncheck it. The check box can be found - # via name, id or label text. If no locator is provided this will match against - # self or a descendant. + # via name, id, {Capybara.configure test_id} attribute, or label text. If + # no locator is provided this will match against self or a descendant. # # # will uncheck a descendant checkbox with a name, id, or label text matching 'German' # page.uncheck('German') @@ -185,7 +185,8 @@ def uncheck(locator = nil, **options) # Otherwise it finds an option inside current scope and selects it. # If the select box is a multiple select, {#select} can be called multiple times to select more than # one option. - # The select box can be found via its name, id or label text. The option can be found by its text. + # The select box can be found via its name, id, {Capybara.configure test_id} attribute, or label text. + # The option can be found by its text. # # page.select 'March', from: 'Month' # @@ -212,7 +213,8 @@ def select(value = nil, from: nil, **options) # # Find a select box on the page and unselect a particular option from it. If the select # box is a multiple select, {#unselect} can be called multiple times to unselect more than - # one option. The select box can be found via its name, id or label text. + # one option. The select box can be found via its name, id, {Capybara.configure test_id} attribute, + # or label text. # # page.unselect 'March', from: 'Month' # @@ -234,8 +236,8 @@ def unselect(value = nil, from: nil, **options) ## # # Find a descendant file field on the page and attach a file given its path. There are two ways to use - # {#attach_file}, in the first method the file field can be found via its name, id or label text. - # In the case of the file field being hidden for + # {#attach_file}, in the first method the file field can be found via its name, id, + # {Capybara.configure test_id} attribute, or label text. In the case of the file field being hidden for # styling reasons the `make_visible` option can be used to temporarily change the CSS of # the file field, attach the file, and then revert the CSS back to original. If no locator is # passed this will match self or a descendant. diff --git a/lib/capybara/selector.rb b/lib/capybara/selector.rb index 825ca8cfb..2b0c0892c 100644 --- a/lib/capybara/selector.rb +++ b/lib/capybara/selector.rb @@ -22,7 +22,8 @@ # * Locator: (String, Regexp, XPath::Expression) The id of the element to match # # * **:field** - Select field elements (input [not of type submit, image, or hidden], textarea, select) -# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, or placeholder +# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, placeholder, or +# associated label text # * Filters: # * :name (String) - Matches the name attribute # * :placeholder (String) - Matches the placeholder attribute @@ -41,8 +42,8 @@ # * :disabled (Boolean) - Match disabled fieldset? # # * **:link** - Find links (`` elements with an href attribute) -# * Locator: Matches the id, {Capybara.configure test_id}, or title attributes, or the string content of the link, or the alt attribute of a contained img element. -# By default this selector requires a link to have an href attribute. +# * Locator: Matches the id, {Capybara.configure test_id}, or title attributes, or the string content of the link, +# or the alt attribute of a contained img element. By default this selector requires a link to have an href attribute. # * Filters: # * :title (String) - Matches the title attribute # * :alt (String) - Matches the alt attribute of a contained img element @@ -63,7 +64,7 @@ # * :disabled (Boolean, :all) - Match disabled buttons? (Default: false) # # * **:fillable_field** - Find text fillable fields ( textarea, input [not of type submit, image, radio, checkbox, hidden, file] ) -# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, or placeholder +# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, placeholder, or associated label text # * Filters: # * :name (String) - Matches the name attribute # * :placeholder (String) - Matches the placeholder attribute @@ -111,7 +112,8 @@ # * :selected (Boolean) - Match selected option # # * **:datalist_input** - Find input field with datalist completion -# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, or placeholder +# * Locator: Matches against the id, {Capybara.configure test_id} attribute, name, +# placeholder, or associated label text # * Filters: # * :name (String) - Matches the name attribute # * :placeholder (String) - Matches the placeholder attribute @@ -149,7 +151,7 @@ # * Locator: Array, Hash table row `` contents - visibility of `` elements is not considered # # * **:frame** - Find frame/iframe elements -# * Locator: Match id or name +# * Locator: Match id, {Capybara.configure test_id} attribute, or name # * Filters: # * :name (String) - Match name attribute #