mirror of
https://github.com/browser-use/browser-use
synced 2026-04-22 17:45:09 +02:00
End of file line
This commit is contained in:
@@ -5,4 +5,4 @@ ANTHROPIC_API_KEY=
|
||||
ANONYMIZED_TELEMETRY=true
|
||||
|
||||
# LogLevel: Set to debug to enable verbose logging, set to result to get results only. Available: result | debug | info
|
||||
BROWSER_USE_LOGGING_LEVEL=info
|
||||
BROWSER_USE_LOGGING_LEVEL=info
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -179,4 +179,4 @@ AgentHistoryList.json
|
||||
*.gif
|
||||
gcp-login.json
|
||||
.vscode
|
||||
.ruff_cache
|
||||
.ruff_cache
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.11
|
||||
3.11
|
||||
|
||||
@@ -37,7 +37,7 @@ class SystemPrompt:
|
||||
]
|
||||
}
|
||||
|
||||
2. ACTIONS: You can specify multiple actions in the list to be executed in sequence. But always specify only one action name per item.
|
||||
2. ACTIONS: You can specify multiple actions in the list to be executed in sequence. But always specify only one action name per item.
|
||||
|
||||
Common action sequences:
|
||||
- Form filling: [
|
||||
@@ -81,13 +81,13 @@ class SystemPrompt:
|
||||
- If you fill an input field and your action sequence is interrupted, most often a list with suggestions popped up under the field and you need to first select the right element from the suggestion list.
|
||||
|
||||
8. ACTION SEQUENCING:
|
||||
- Actions are executed in the order they appear in the list
|
||||
- Actions are executed in the order they appear in the list
|
||||
- Each action should logically follow from the previous one
|
||||
- If the page changes after an action, the sequence is interrupted and you get the new state.
|
||||
- If content only disappears the sequence continues.
|
||||
- Only provide the action sequence until you think the page will change.
|
||||
- Try to be efficient, e.g. fill forms at once, or chain actions where nothing changes on the page like saving, extracting, checkboxes...
|
||||
- only use multiple actions if it makes sense.
|
||||
- only use multiple actions if it makes sense.
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@@ -287,7 +287,7 @@ class Controller:
|
||||
const select = document.evaluate(xpath, document, null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
||||
if (!select) return null;
|
||||
|
||||
|
||||
return {
|
||||
options: Array.from(select.options).map(opt => ({
|
||||
text: opt.text, //do not trim, because we are doing exact match in select_dropdown_option
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
// Generate a color based on the index
|
||||
const colors = [
|
||||
'#FF0000', '#00FF00', '#0000FF', '#FFA500',
|
||||
'#FF0000', '#00FF00', '#0000FF', '#FFA500',
|
||||
'#800080', '#008080', '#FF69B4', '#4B0082',
|
||||
'#FF4500', '#2E8B57', '#DC143C', '#4682B4'
|
||||
];
|
||||
@@ -72,7 +72,7 @@
|
||||
// Calculate label position
|
||||
const labelWidth = 20; // Approximate width
|
||||
const labelHeight = 16; // Approximate height
|
||||
|
||||
|
||||
// Default position (top-right corner inside the box)
|
||||
let labelTop = top + 2;
|
||||
let labelLeft = left + rect.width - labelWidth - 2;
|
||||
@@ -155,7 +155,7 @@
|
||||
'slider', 'tab', 'tabpanel', 'textbox', 'combobox', 'grid',
|
||||
'listbox', 'option', 'progressbar', 'scrollbar', 'searchbox',
|
||||
'switch', 'tree', 'treeitem', 'spinbutton', 'tooltip', 'a-button-inner', 'a-dropdown-button', 'click',
|
||||
'menuitemcheckbox', 'menuitemradio', 'a-button-text', 'button-text', 'button-icon', 'button-icon-only', 'button-text-icon-only', 'dropdown', 'combobox'
|
||||
'menuitemcheckbox', 'menuitemradio', 'a-button-text', 'button-text', 'button-icon', 'button-icon-only', 'button-text-icon-only', 'dropdown', 'combobox'
|
||||
]);
|
||||
|
||||
const tagName = element.tagName.toLowerCase();
|
||||
@@ -435,4 +435,4 @@
|
||||
|
||||
|
||||
return buildDomTree(document.body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ async def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
asyncio.run(main())
|
||||
|
||||
@@ -77,8 +77,8 @@ def create_twitter_agent(config: TwitterConfig) -> Agent:
|
||||
|
||||
# Create the agent with detailed instructions
|
||||
return Agent(
|
||||
task=f"""Navigate to Twitter and create a post and reply to a tweet.
|
||||
|
||||
task=f"""Navigate to Twitter and create a post and reply to a tweet.
|
||||
|
||||
Here are the specific steps:
|
||||
|
||||
1. Go to {config.base_url}. See the text input field at the top of the page that says "What's happening?"
|
||||
@@ -87,11 +87,11 @@ def create_twitter_agent(config: TwitterConfig) -> Agent:
|
||||
"{full_message}"
|
||||
4. Find and click the "Post" button (look for attributes: 'button' and 'data-testid="tweetButton"')
|
||||
5. Do not click on the '+' button which will add another tweet.
|
||||
|
||||
|
||||
6. Navigate to {config.reply_url}
|
||||
7. Before replying, understand the context of the tweet by scrolling down and reading the comments.
|
||||
8. Reply to the tweet under 50 characters.
|
||||
|
||||
|
||||
Important:
|
||||
- Wait for each element to load before interacting
|
||||
- Make sure the message is typed exactly as shown
|
||||
@@ -114,7 +114,7 @@ async def post_tweet(agent: Agent):
|
||||
print(f"Error posting tweet: {str(e)}")
|
||||
|
||||
|
||||
def main():
|
||||
def main():
|
||||
agent = create_twitter_agent(config)
|
||||
asyncio.run(post_tweet(agent))
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
123
|
||||
123
|
||||
|
||||
@@ -26,4 +26,3 @@ filterwarnings =
|
||||
ignore::DeprecationWarning
|
||||
|
||||
log_level = INFO
|
||||
|
||||
|
||||
@@ -16855,4 +16855,4 @@
|
||||
"[span] Final -> CLICK"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user