Sha256: 88e6a964756aceb5b8669a74fa874f6c565fc65e69597a05425540c75682804c
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# Pages Retrieved pages are represented by `Wayfarer::Page` objects and are available within jobs like so: ```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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.1 | docs/guides/pages.md |
wayfarer-0.4.0 | docs/guides/pages.md |