Spaces:
Running
Running
Update tools/interact_element.py
Browse files- tools/interact_element.py +26 -6
tools/interact_element.py
CHANGED
@@ -51,15 +51,35 @@ def interact_element(driver, selector=None, text=None, action="click", input_tex
|
|
51 |
return f"Failed to interact with element {selector or text}: {str(e)}"
|
52 |
|
53 |
# Register the tool
|
54 |
-
|
55 |
name="interact_element",
|
56 |
description="Interacts with a web element (click, fill text, press keys).",
|
57 |
inputs={
|
58 |
-
"selector": {
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
},
|
64 |
output_type="str",
|
65 |
function=interact_element
|
|
|
51 |
return f"Failed to interact with element {selector or text}: {str(e)}"
|
52 |
|
53 |
# Register the tool
|
54 |
+
interact_element_tool = Tool(
|
55 |
name="interact_element",
|
56 |
description="Interacts with a web element (click, fill text, press keys).",
|
57 |
inputs={
|
58 |
+
"selector": {
|
59 |
+
"type": "str",
|
60 |
+
"default": None,
|
61 |
+
"description": "CSS selector to target element"
|
62 |
+
},
|
63 |
+
"text": {
|
64 |
+
"type": "str",
|
65 |
+
"default": None,
|
66 |
+
"description": "Text to locate element"
|
67 |
+
},
|
68 |
+
"action": {
|
69 |
+
"type": "str",
|
70 |
+
"default": "click",
|
71 |
+
"description": "Action: 'click', 'fill', or 'press'"
|
72 |
+
},
|
73 |
+
"input_text": {
|
74 |
+
"type": "str",
|
75 |
+
"default": None,
|
76 |
+
"description": "Text to input for fill action"
|
77 |
+
},
|
78 |
+
"key": {
|
79 |
+
"type": "str",
|
80 |
+
"default": None,
|
81 |
+
"description": "Key to press (e.g., 'ENTER')"
|
82 |
+
}
|
83 |
},
|
84 |
output_type="str",
|
85 |
function=interact_element
|