Class: OmniAI::Tools::Browser::PageInspectTool

Inherits:
BaseTool
  • Object
show all
Includes:
InspectUtils
Defined in:
lib/omniai/tools/browser/page_inspect_tool.rb

Overview

A browser automation tool for viewing the full HTML of the page.

Instance Method Summary collapse

Methods included from InspectUtils

#add_elements_from_matching_labels, #ci_contains, #clean_document, #cleaned_document, #find_elements_with_matching_text

Methods inherited from BaseTool

#initialize

Constructor Details

This class inherits a constructor from OmniAI::Tools::Browser::BaseTool

Instance Method Details

#execute(summarize: false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/omniai/tools/browser/page_inspect_tool.rb', line 16

def execute(summarize: false)
  @logger.info("#{self.class.name}##{__method__}")

  doc = cleaned_document(html: @driver.html)

  if summarize
    PageInspect::HtmlSummarizer.summarize_interactive_elements(doc)
  else
    doc.to_html
  end
end