Class: SharedTools::Tools::Browser::VisitTool

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/shared_tools/tools/browser/visit_tool.rb

Overview

Examples:

driver = Selenium::WebDriver.for :chrome
tool = SharedTools::Tools::Browser::VisitTool.new(driver:)
tool.execute(to: "https://news.ycombinator.com")

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver: nil, logger: nil) ⇒ VisitTool

Returns a new instance of VisitTool.



19
20
21
22
# File 'lib/shared_tools/tools/browser/visit_tool.rb', line 19

def initialize(driver: nil, logger: nil)
  @driver = driver || default_driver
  @logger = logger || RubyLLM.logger
end

Class Method Details

.nameObject



11
# File 'lib/shared_tools/tools/browser/visit_tool.rb', line 11

def self.name = 'browser_visit'

Instance Method Details

#execute(url:) ⇒ Object

Parameters:



25
26
27
28
29
# File 'lib/shared_tools/tools/browser/visit_tool.rb', line 25

def execute(url:)
  @logger.info("#{self.class.name}##{__method__} url=#{url.inspect}")

  @driver.goto(url:)
end