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)
| 288 | ) |
| 289 | @register_tool("input_text") |
| 290 | def 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") |
| 312 | def visit_url(context_variables, url: str): |
nothing calls this directly
no test coverage detected