Class: OmniAI::Tools::Browser::InspectTool

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

Overview

A browser automation tool for finding UI elements by their text content.

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(text_content:, selector: nil, context_size: 2) ⇒ Object



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

def execute(text_content:, selector: nil, context_size: 2)
  @logger.info("#{self.class.name}##{__method__}")

  html = @driver.html

  @logger.info("#{self.class.name}##{__method__} html=#{html}")

  doc = cleaned_document(html: @driver.html)
  find_elements_by_text(doc, text_content, context_size, selector)
end