Class: OmniAI::Tools::Browser::SelectorInspectTool
- Inherits:
-
BaseTool
- Object
- OmniAI::Tool
- BaseTool
- OmniAI::Tools::Browser::SelectorInspectTool
- Includes:
- InspectUtils
- Defined in:
- lib/omniai/tools/browser/selector_inspect_tool.rb
Overview
A browser automation tool for inspecting elements using CSS selectors.
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
Constructor Details
This class inherits a constructor from OmniAI::Tools::Browser::BaseTool
Instance Method Details
#execute(selector:, context_size: 2) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/omniai/tools/browser/selector_inspect_tool.rb', line 17 def execute(selector:, context_size: 2) @logger.info("#{self.class.name}##{__method__}") doc = cleaned_document(html: @driver.html) target_elements = doc.css(selector) return "No elements found matching selector: #{selector}" if target_elements.empty? format_elements(target_elements, selector, context_size) end |