Skip to content

Commit 7711946

Browse files
committedJan 20, 2025
End of file line
1 parent e7edb94 commit 7711946

File tree

11 files changed

+19
-20
lines changed

11 files changed

+19
-20
lines changed
 

‎.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ ANTHROPIC_API_KEY=
55
ANONYMIZED_TELEMETRY=true
66

77
# LogLevel: Set to debug to enable verbose logging, set to result to get results only. Available: result | debug | info
8-
BROWSER_USE_LOGGING_LEVEL=info
8+
BROWSER_USE_LOGGING_LEVEL=info

‎.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,4 @@ AgentHistoryList.json
179179
*.gif
180180
gcp-login.json
181181
.vscode
182-
.ruff_cache
182+
.ruff_cache

‎.python-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11
1+
3.11

‎browser_use/agent/prompts.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def important_rules(self) -> str:
3737
]
3838
}
3939
40-
2. ACTIONS: You can specify multiple actions in the list to be executed in sequence. But always specify only one action name per item.
40+
2. ACTIONS: You can specify multiple actions in the list to be executed in sequence. But always specify only one action name per item.
4141
4242
Common action sequences:
4343
- Form filling: [
@@ -81,13 +81,13 @@ def important_rules(self) -> str:
8181
- 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.
8282
8383
8. ACTION SEQUENCING:
84-
- Actions are executed in the order they appear in the list
84+
- Actions are executed in the order they appear in the list
8585
- Each action should logically follow from the previous one
8686
- If the page changes after an action, the sequence is interrupted and you get the new state.
8787
- If content only disappears the sequence continues.
8888
- Only provide the action sequence until you think the page will change.
8989
- Try to be efficient, e.g. fill forms at once, or chain actions where nothing changes on the page like saving, extracting, checkboxes...
90-
- only use multiple actions if it makes sense.
90+
- only use multiple actions if it makes sense.
9191
9292
9393
"""

‎browser_use/controller/service.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ async def get_dropdown_options(index: int, browser: BrowserContext) -> ActionRes
287287
const select = document.evaluate(xpath, document, null,
288288
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
289289
if (!select) return null;
290-
290+
291291
return {
292292
options: Array.from(select.options).map(opt => ({
293293
text: opt.text, //do not trim, because we are doing exact match in select_dropdown_option

‎browser_use/dom/buildDomTree.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
// Generate a color based on the index
2727
const colors = [
28-
'#FF0000', '#00FF00', '#0000FF', '#FFA500',
28+
'#FF0000', '#00FF00', '#0000FF', '#FFA500',
2929
'#800080', '#008080', '#FF69B4', '#4B0082',
3030
'#FF4500', '#2E8B57', '#DC143C', '#4682B4'
3131
];
@@ -72,7 +72,7 @@
7272
// Calculate label position
7373
const labelWidth = 20; // Approximate width
7474
const labelHeight = 16; // Approximate height
75-
75+
7676
// Default position (top-right corner inside the box)
7777
let labelTop = top + 2;
7878
let labelLeft = left + rect.width - labelWidth - 2;
@@ -155,7 +155,7 @@
155155
'slider', 'tab', 'tabpanel', 'textbox', 'combobox', 'grid',
156156
'listbox', 'option', 'progressbar', 'scrollbar', 'searchbox',
157157
'switch', 'tree', 'treeitem', 'spinbutton', 'tooltip', 'a-button-inner', 'a-dropdown-button', 'click',
158-
'menuitemcheckbox', 'menuitemradio', 'a-button-text', 'button-text', 'button-icon', 'button-icon-only', 'button-text-icon-only', 'dropdown', 'combobox'
158+
'menuitemcheckbox', 'menuitemradio', 'a-button-text', 'button-text', 'button-icon', 'button-icon-only', 'button-text-icon-only', 'dropdown', 'combobox'
159159
]);
160160

161161
const tagName = element.tagName.toLowerCase();
@@ -435,4 +435,4 @@
435435

436436

437437
return buildDomTree(document.body);
438-
}
438+
}

‎examples/ollama.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ async def main():
3030

3131

3232
if __name__ == "__main__":
33-
asyncio.run(main())
33+
asyncio.run(main())

‎examples/post-twitter.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def create_twitter_agent(config: TwitterConfig) -> Agent:
7777

7878
# Create the agent with detailed instructions
7979
return Agent(
80-
task=f"""Navigate to Twitter and create a post and reply to a tweet.
81-
80+
task=f"""Navigate to Twitter and create a post and reply to a tweet.
81+
8282
Here are the specific steps:
8383
8484
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:
8787
"{full_message}"
8888
4. Find and click the "Post" button (look for attributes: 'button' and 'data-testid="tweetButton"')
8989
5. Do not click on the '+' button which will add another tweet.
90-
90+
9191
6. Navigate to {config.reply_url}
9292
7. Before replying, understand the context of the tweet by scrolling down and reading the comments.
9393
8. Reply to the tweet under 50 characters.
94-
94+
9595
Important:
9696
- Wait for each element to load before interacting
9797
- Make sure the message is typed exactly as shown
@@ -114,7 +114,7 @@ async def post_tweet(agent: Agent):
114114
print(f"Error posting tweet: {str(e)}")
115115

116116

117-
def main():
117+
def main():
118118
agent = create_twitter_agent(config)
119119
asyncio.run(post_tweet(agent))
120120

‎examples/test_cv.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
123
1+
123

‎pytest.ini

-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ filterwarnings =
2626
ignore::DeprecationWarning
2727

2828
log_level = INFO
29-

‎tests/mind2web_data/processed.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16855,4 +16855,4 @@
1685516855
"[span] Final -> CLICK"
1685616856
]
1685716857
}
16858-
]
16858+
]

0 commit comments

Comments
 (0)
Please sign in to comment.