Firoj112 commited on
Commit
0c5cccf
·
verified ·
1 Parent(s): 654b1c5

Update tools/interact_element.py

Browse files
Files changed (1) hide show
  1. tools/interact_element.py +7 -12
tools/interact_element.py CHANGED
@@ -6,23 +6,18 @@ class InteractElementTool(Tool):
6
  name = "interact_element"
7
  description = "Interacts with a web element (click, fill text, press keys)."
8
  inputs = {
9
- "selector": {"type": "str", "default": None, "description": "CSS selector to target element"},
10
- "text": {"type": "str", "default": None, "description": "Text to locate element"},
11
- "action": {"type": "str", "default": "click", "description": "Action: 'click', 'fill', or 'press'"},
12
- "input_text": {"type": "str", "default": None, "description": "Text to input for fill action"},
13
- "key": {"type": "str", "default": None, "description": "Key to press (e.g., 'ENTER')"}
14
  }
15
- output_type = "str"
16
 
17
  def __init__(self, driver):
18
  self.driver = driver
19
 
20
- def forward(self, **kwargs):
21
- selector = kwargs.get("selector")
22
- text = kwargs.get("text")
23
- action = kwargs.get("action", "click")
24
- input_text = kwargs.get("input_text")
25
- key = kwargs.get("key")
26
  try:
27
  if selector:
28
  element = self.driver.find_element(By.CSS_SELECTOR, selector)
 
6
  name = "interact_element"
7
  description = "Interacts with a web element (click, fill text, press keys)."
8
  inputs = {
9
+ "selector": {"type": "string", "default": None, "description": "CSS selector to target element"},
10
+ "text": {"type": "string", "default": None, "description": "Text to locate element"},
11
+ "action": {"type": "string", "default": "click", "description": "Action: 'click', 'fill', or 'press'"},
12
+ "input_text": {"type": "string", "default": None, "description": "Text to input for fill action"},
13
+ "key": {"type": "string", "default": None, "description": "Key to press (e.g., 'ENTER')"}
14
  }
15
+ output_type = "string"
16
 
17
  def __init__(self, driver):
18
  self.driver = driver
19
 
20
+ def forward(self, selector=None, text=None, action="click", input_text=None, key=None):
 
 
 
 
 
21
  try:
22
  if selector:
23
  element = self.driver.find_element(By.CSS_SELECTOR, selector)