WebAgents_ / tools /go_back.py
Firoj112's picture
Update tools/go_back.py
52bccd1 verified
raw
history blame contribute delete
515 Bytes
from typing import Any
from smolagents.tools import Tool
class GoBackTool(Tool):
name = "go_back"
description = "Goes back to the previous page."
inputs = {}
output_type = "null"
def __init__(self, driver: Any = None, *args, **kwargs):
super().__init__(*args, **kwargs)
self.driver = driver
self.is_initialized = False
def forward(self) -> None:
if not self.driver:
raise ValueError("WebDriver instance is required.")
self.driver.back()