MCPcopy Create free account
hub / github.com/HKUDS/AutoAgent / input_text

Function input_text

autoagent/tools/web_tools.py:290–309  ·  view source on GitHub ↗

Types the given text value into the specified field. Args: bid: The bid of the element to type into. text: The text to type into the input field.

(context_variables, bid: str, text: str)

Source from the content-addressed store, hash-verified

288 )
289@register_tool("input_text")
290def input_text(context_variables, bid: str, text: str):
291 """
292 Types the given text value into the specified field.
293 Args:
294 bid: The bid of the element to type into.
295 text: The text to type into the input field.
296 """
297 env: BrowserEnv = context_variables.get("web_env", None)
298 assert env is not None, "web_env is not set"
299 try:
300 action_str = f"fill('{bid}', '{text}')"
301 obs = env.step(action_str)
302 web_obs = to_web_obs(obs)
303 except Exception as e:
304 return f"Error encountered when taking action: {action_str}\nError: {e}"
305 ret_value = wrap_return_value(web_obs)
306 return Result(
307 value=ret_value,
308 image=web_obs.screenshot,
309 )
310
311@register_tool("visit_url")
312def visit_url(context_variables, url: str):

Callers

nothing calls this directly

Calls 5

ResultClass · 0.90
to_web_obsFunction · 0.85
wrap_return_valueFunction · 0.85
getMethod · 0.80
stepMethod · 0.80

Tested by

no test coverage detected