Class: Browserctl::Snapshot::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/browserctl/snapshot/extractor.rb

Overview

Stage 1 of the snapshot pipeline.

Parses raw HTML and returns the set of interactable Nokogiri nodes that the rest of the pipeline will annotate. This stage knows nothing about refs, fingerprints, or wire format.

Constant Summary collapse

INTERACTABLE =
%w[a button input select textarea
[role=button] [role=link] [role=menuitem]].freeze

Instance Method Summary collapse

Instance Method Details

#call(html) ⇒ Object



16
17
18
# File 'lib/browserctl/snapshot/extractor.rb', line 16

def call(html)
  Nokogiri::HTML(html).css(INTERACTABLE.join(",")).to_a
end