Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Turn result to str
Magnus Müller49ad909f2b7a
diff --git a/browser_use/tools/service.py b/browser_use/tools/service.pyindex 11550e3ea..adcdc8a02 100644--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@ -926,7 +926,7 @@ JSON.stringify(Array.from(document.querySelectorAll('a')).map(el => el.textConteparams={'expression': code, 'returnByValue': True}, session_id=cdp_session.session_id)result_text = result.get('result', {}).get('value', '')-+ result_text = str(result_text)if len(result_text) > 20000:result_text = result_text[:20000] + ' Truncated after 20000 characters ...'# Return the result (could be empty string, which is valid)