Form filters are just a more convenient shorthand for other expressions.
- :input matches all input, textarea, select, and button elements.
- :text, :hidden, :password, :radio, :checkbox, :submit, :image, :reset, and file all matches input elements with their respective types.
- :button matches all button elements and input elements of type button.
- :enabled matches all form elements that are not disabled, :disabled matches those that are.
- :checked matches all radio and checkbox elements that are checked.
- :selected matches all option elements that are selected.
Selector
|
CSS
|
CSS Alt
|
XPath
|
all form elements
|
:input
|
input, textarea, select, button
|
//input|//textarea|
//select|//button
|
form elements of specific types
|
:text
|
input [type="text"]
|
//input[type="text"]
|
button elements
|
:button
|
button, input[type="button"]
|
//button|//input
[type="button"]
|
enabled elements
|
:enabled
|
:not([disabled="disabled"])
|
//*[contains("input textarea select button", name()) and (not(@disabled) or @disabled!= "disabled"])
|
disabled elements
|
:disabled
|
[disabled="disabled"]
|
//*[contains("input textarea select button", name()) and @disabled="disabled"]
|
checked elements
|
:checked
|
:input[checked="checked"]
|
//input[contains ("checkbox radio", @type) and @checked="checked"]
|
selected elements
|
:selected
|
option[selected="selected"]
|
//option[@selected="selected"]
|
© CSS Selector Libraries — Web Scraping
>>> Back to TABLE OF CONTENTS <<< |