class

Mechanize::Form

Inherits Mechanize::ElementMatcher / Reference / Object

This class represents the form tag of html.

Constructors

new(node : Mechanize::Node | Lexbor::Node, page : Page | Nil = nil)
Source

Instance methods

action

return form's 'action' attribute.

Source
action=(action : String)

return form's 'action' attribute.

Source
add_button_to_query(button)

This method adds a button to the query. If the form needs to be submitted with multiple buttons, pass each button to this method.

Source
button_with(criteria)

returns first element of #buttons_with

Source
buttons

returns an array of button tags and input tag whose type is button,submit,reset,image.

Source
buttons_with(criteria : String | NamedTuple | Hash(String, String))

search buttons which match condition.

Examples

# if you specify String like "foo", it searches button which name is "foo".
# like <button name="foo"></button>
page.buttons_with("foo")
# you can also specify tag's attribute and its' value by NamedTuple or Hash(String, String).
# ex) <button class="foo"></button>
page.buttons_with("class" => "foo")
page.buttons_with(class: "foo")
Source
buttons_with(criteria, &)
Source
checkbox_with(criteria)

returns first element of #checkboxes_with

Source
checkboxes

returns an array of input tags whose type is checkbox in the form.

Source
checkboxes_with(criteria : String | NamedTuple | Hash(String, String))

search checkboxes which match condition.

Examples

# if you specify String like "foo", it searches checkbox which name is "foo".
# like <input type="checkbox" name="foo"></input>
page.checkboxes_with("foo")
# you can also specify tag's attribute and its' value by NamedTuple or Hash(String, String).
# ex) <input type="checkbox" class="foo"></input>
page.checkboxes_with("class" => "foo")
page.checkboxes_with(class: "foo")
Source
checkboxes_with(criteria, &)
Source
enctype

returns form's 'enctype' attribute.

Source
field_with(criteria)

returns first element of #fields_with

Source
fields

returns hoge array of Mechanize::FormContent::Field in the form.

Source
fields_with(criteria : String | NamedTuple | Hash(String, String))

search fields which match condition.

Examples

# if you specify String like "foo", it searches field which name is "foo".
# like <input name="foo"></input>
page.fields_with("foo")
# you can also specify tag's attribute and its' value by NamedTuple or Hash(String, String).
# ex) <input class="foo"></input>
page.fields_with("class" => "foo")
page.fields_with(class: "foo")
Source
fields_with(criteria, &)
Source
method

returns form's 'method' attribute.

Source
name

returns form's 'name' attribute.

Source
node
Source
page

returns the page which includes the form.

Source
radiobutton_with(criteria)

returns first element of #radiobuttons_with

Source
radiobuttons

returns an array of input tags whose type is radio in the form.

Source
radiobuttons_with(criteria : String | NamedTuple | Hash(String, String))

search radiobuttons which match condition.

Examples

# if you specify String like "foo", it searches radiobutton which name is "foo".
# like <input type="radio" name="foo"></input>
page.radiobuttons_with("foo")
# you can also specify tag's attribute and its' value by NamedTuple or Hash(String, String).
# ex) <input type="radio" class="foo"></input>
page.radiobuttons_with("class" => "foo")
page.radiobuttons_with(class: "foo")
Source
radiobuttons_with(criteria, &)
Source
request_data
Source
selectboxes

returns an array of input tags whose type is select in the form.

Source
textareas

Returns all fields of <input type="textarea">

Source