Sha256: add8ce43dc386e006f3642f6e8abd9692d827639772e0c416cb2973d6d084c8e
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 KB
Contents
# Pages Retrieved pages take the shape of `Wayfarer::Page` objects and are available to jobs: ```ruby class DummyJob < Wayfarer::Worker route { to :index } def index page # => #<Wayfarer::Page ...> page.url # => "https://example.com" page.body # => "<html>..." page.status_code # => 200 page.headers # => { "Content-Type" => ... } # A MetaInspector object for accessing page meta data. # See: https://github.com/metainspector/metainspector # Examples: page.meta.links.internal page.meta.images.favicon page.meta.description page.meta.feeds end end ``` ## Live pages When automating browsers, it is possible the page changes significantly at runtime, for example due to JavaScript altering the DOM or URL. To access a page reflecting the current browser state, pass the `live` keyword: ```ruby class DummyJob < Wayfarer::Worker route { to :index } def index page # => #<Wayfarer::Page ...> # Replaces the current Page object with a newer one, # taking into account the DOM as currently rendered by the browser. # Effectful only when automating browsers, no-op when using plain # HTTP. page(live: true) page # => The live page returned above end end ```
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.6 | docs/guides/pages.md |
wayfarer-0.4.5 | docs/guides/pages.md |
wayfarer-0.4.4 | docs/guides/pages.md |
wayfarer-0.4.3 | docs/guides/pages.md |
wayfarer-0.4.2 | docs/guides/pages.md |