Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

update extract_content further

mertunsall9459cd4f5b86
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index afb31431d..2ed14504c 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -273,7 +273,7 @@ class Controller(Generic[Context]):
content += f'\n\nIFRAME {iframe.url}:\n'
content += markdownify.markdownify(await iframe.content())
- prompt = 'Extract information from this webpage based on the query. Focus only on content relevant to the query. If the query is vague, provide a brief summary of the page. Respond in JSON format.\nQuery: {content_to_extract}\nPage content: {page}'
+ prompt = 'Extract information from this webpage based on the query. Focus only on content relevant to the query. If the query is vague, provide a brief summary of the page. Respond in JSON format.\nQuery: {content_to_extract}\nPage content:\n{page}'
template = PromptTemplate(input_variables=['content_to_extract', 'page'], template=prompt)
try:
output = await page_extraction_llm.ainvoke(template.format(content_to_extract=content_to_extract, page=content))