class

Mechanize::Page

Inherits Mechanize::ElementMatcher / Mechanize::File / Reference / Object

This class represents the result of http response. If you send a request, it returns the instance of Mechanize::Page. You can get status code, title, and page body, and search html node using css selector from page instance.

Constructors

new(uri, response, body, code, mech : Mechanize)
Source

Instance methods

css(*args, **options)

look at lexbor document.(https://github.com/kostya/lexbor#readme)

Source
css(*args, **options, &)

look at lexbor document.(https://github.com/kostya/lexbor#readme)

Source
form_with(criteria)

returns first element of #forms_with

Source
forms

return all forms(Mechanize::Form) in the page.

page.forms # => Array(Mechanize::Form)
Source
forms_with(criteria : String | NamedTuple | Hash(String, String))

search forms which match condition.

Examples

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

parser to parse response body. TODO: now it's Lexbor::Parser. I want to also support other parsers like JSON.

Source
title

return page title.

page.title # => String
Source