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
skip iframes that mightve closed during iteration
Nick Sweeting31bd5fdbf227
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 902f1dbb9..2c5d53dc4 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -256,8 +256,12 @@ class Controller(Generic[Context]):if iframe.url != page.url and not iframe.url.startswith('data:'):content += f'\n\nIFRAME {iframe.url}:\n'# Run markdownify in a thread pool for iframe content as well- iframe_html = await iframe.content()- iframe_markdown = await loop.run_in_executor(None, markdownify_func, iframe_html)+ try:+ iframe_html = await iframe.content()+ iframe_markdown = await loop.run_in_executor(None, markdownify_func, iframe_html)+ except Exception as e:+ logger.debug(f'Error extracting iframe content from within page {page.url}: {type(e).__name__}: {e}')+ iframe_markdown = ''content += iframe_markdownprompt = 'Your task is to extract the content of the page. You will be given a page and a goal and you should extract all relevant information around this goal from the page. If the goal is vague, summarize the page. Respond in json format. Extraction goal: {goal}, Page: {page}'