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
fix element hash
Magnus Müller9618835c9764
diff --git a/browser_use/dom/views.py b/browser_use/dom/views.pyindex cbcaadaa1..49fbb8edf 100644--- a/browser_use/dom/views.py+++ b/browser_use/dom/views.py@@ -684,7 +684,20 @@ class EnhancedDOMTreeNode:parent_branch_path_string = '/'.join(parent_branch_path)# Get attributes hash- attributes_string = ''.join(f'{key}={value}' for key, value in self.attributes.items())+ static_attributes = set(+ [+ 'class',+ 'id',+ 'name',+ 'type',+ 'placeholder',+ 'aria-label',+ 'title',+ 'value',+ 'aria-expanded',+ ]+ )+ attributes_string = ''.join(f'{key}={value}' for key, value in self.attributes.items() if key in static_attributes)# Combine both for final hashcombined_string = f'{parent_branch_path_string}|{attributes_string}'diff --git a/examples/features/rerun_history.py b/examples/features/rerun_history.pyindex dac51b4c1..0cd8a9f8f 100644--- a/examples/features/rerun_history.py+++ b/examples/features/rerun_history.py@@ -24,42 +24,23 @@ from browser_use.llm.openai.chat import ChatOpenAIasync def main():# Example task to demonstrate history saving and rerunning- task = 'Go to GitHub and find the browser-use repository'history_file = Path('agent_history.json')+ task = 'Go to GitHub and find the browser-use repository'llm = ChatOpenAI(model='gpt-4.1-mini')- # Step 1: Run agent and save history- print('🚀 Running agent and saving history...')-- agent = Agent(- task=task,- llm=llm,- )+ # agent = Agent(task=task, llm=llm)- # Run the agent- history = await agent.run(max_steps=5)+ # await agent.run(max_steps=5)- # Save the history for later rerun- agent.save_history(history_file)+ # agent.save_history(history_file)- print(f'✅ History saved to {history_file}')- print(f'📊 Completed {len(history.history)} steps')-- # Step 2: Load and rerun the history- print('\n🔄 Loading and rerunning history...')-- # Create new agent for rerunning (task can be empty since we're replaying)- rerun_agent = Agent(- task='',- llm=llm,- )+ rerun_agent = Agent(task='', llm=llm)- # Load and rerun the saved historyresults = await rerun_agent.load_and_rerun(history_file=history_file,- max_retries=3, # Retry failed actions up to 3 times- skip_failures=True, # Continue even if some actions fail- delay_between_actions=1.0, # Wait 1 second between actions+ max_retries=3,+ skip_failures=True,+ delay_between_actions=1.0,)