-
Notifications
You must be signed in to change notification settings - Fork 4
Add CLI documentation page #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mintlify
wants to merge
1
commit into
main
Choose a base branch
from
mintlify/cli-docs-1773354647
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,262 @@ | ||
| --- | ||
| title: "CLI" | ||
| description: "Control browsers from the command line with navigation, interaction, cookies, JavaScript execution, and agent tasks." | ||
| icon: "terminal" | ||
| --- | ||
|
|
||
| The Browser Use CLI provides direct browser control without writing Python code. Install the package and run commands to navigate, interact, manage cookies, and execute agent tasks. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install browser-use | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Mirror the documented setup flow here; Prompt for AI agents |
||
| ``` | ||
|
|
||
| Verify the installation: | ||
|
|
||
| ```bash | ||
| browser-use --help | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| ### Navigation | ||
|
|
||
| Navigate to a URL: | ||
|
|
||
| ```bash | ||
| browser-use navigate --url "https://example.com" | ||
| ``` | ||
|
|
||
| Go back or forward: | ||
|
|
||
| ```bash | ||
| browser-use back | ||
| browser-use forward | ||
| ``` | ||
|
|
||
| Refresh the current page: | ||
|
|
||
| ```bash | ||
| browser-use refresh | ||
| ``` | ||
|
|
||
| ### Interaction | ||
|
|
||
| Click an element by selector: | ||
|
|
||
| ```bash | ||
| browser-use click --selector "#submit-button" | ||
| ``` | ||
|
|
||
| Type text into an input field: | ||
|
|
||
| ```bash | ||
| browser-use type --selector "#search" --text "browser automation" | ||
| ``` | ||
|
|
||
| Scroll the page: | ||
|
|
||
| ```bash | ||
| browser-use scroll --direction down --amount 500 | ||
| ``` | ||
|
|
||
| Take a screenshot: | ||
|
|
||
| ```bash | ||
| browser-use screenshot --output screenshot.png | ||
| ``` | ||
|
|
||
| ### Cookies | ||
|
|
||
| Export cookies to a file: | ||
|
|
||
| ```bash | ||
| browser-use cookies export --output cookies.json | ||
| ``` | ||
|
|
||
| Import cookies from a file: | ||
|
|
||
| ```bash | ||
| browser-use cookies import --input cookies.json | ||
| ``` | ||
|
|
||
| Clear all cookies: | ||
|
|
||
| ```bash | ||
| browser-use cookies clear | ||
| ``` | ||
|
|
||
| ### Wait | ||
|
|
||
| Wait for an element to appear: | ||
|
|
||
| ```bash | ||
| browser-use wait --selector "#loading" --state hidden | ||
| ``` | ||
|
|
||
| Wait for a specific duration (in milliseconds): | ||
|
|
||
| ```bash | ||
| browser-use wait --timeout 3000 | ||
| ``` | ||
|
|
||
| ### JavaScript | ||
|
|
||
| Execute JavaScript in the browser: | ||
|
|
||
| ```bash | ||
| browser-use js --code "document.title" | ||
| ``` | ||
|
|
||
| Execute JavaScript from a file: | ||
|
|
||
| ```bash | ||
| browser-use js --file script.js | ||
| ``` | ||
|
|
||
| ## Agent tasks | ||
|
|
||
| Run an AI agent to complete a task: | ||
|
|
||
| ```bash | ||
| browser-use agent --task "Find the top post on Hacker News" | ||
| ``` | ||
|
|
||
| Specify a model: | ||
|
|
||
| ```bash | ||
| browser-use agent --task "Search for flights to Paris" --model gpt-4.1-mini | ||
| ``` | ||
|
|
||
| Use a custom prompt: | ||
|
|
||
| ```bash | ||
| browser-use agent --task "Fill out the contact form" --system-prompt "Be concise and efficient" | ||
| ``` | ||
|
|
||
| ## Cloud sessions | ||
|
|
||
| Connect to a Browser Use Cloud session: | ||
|
|
||
| ```bash | ||
| browser-use cloud connect --session-id <session-id> | ||
| ``` | ||
|
|
||
| Create a new cloud session: | ||
|
|
||
| ```bash | ||
| browser-use cloud create | ||
| ``` | ||
|
|
||
| List active sessions: | ||
|
|
||
| ```bash | ||
| browser-use cloud list | ||
| ``` | ||
|
|
||
| <Note> | ||
| Cloud sessions require a `BROWSER_USE_API_KEY`. Set it in your environment or `.env` file. | ||
| </Note> | ||
|
|
||
| ## Tunnels | ||
|
|
||
| Expose your local browser to the cloud: | ||
|
|
||
| ```bash | ||
| browser-use tunnel start | ||
| ``` | ||
|
|
||
| Stop an active tunnel: | ||
|
|
||
| ```bash | ||
| browser-use tunnel stop | ||
| ``` | ||
|
|
||
| Check tunnel status: | ||
|
|
||
| ```bash | ||
| browser-use tunnel status | ||
| ``` | ||
|
|
||
| ## Profile management | ||
|
|
||
| Create a browser profile: | ||
|
|
||
| ```bash | ||
| browser-use profile create --name "work" | ||
| ``` | ||
|
|
||
| List available profiles: | ||
|
|
||
| ```bash | ||
| browser-use profile list | ||
| ``` | ||
|
|
||
| Use a specific profile: | ||
|
|
||
| ```bash | ||
| browser-use navigate --url "https://example.com" --profile "work" | ||
| ``` | ||
|
|
||
| Delete a profile: | ||
|
|
||
| ```bash | ||
| browser-use profile delete --name "work" | ||
| ``` | ||
|
|
||
| ## Usage examples | ||
|
|
||
| ### Complete workflow | ||
|
|
||
| Navigate, interact, and extract data: | ||
|
|
||
| ```bash | ||
| # Start browser and navigate | ||
| browser-use navigate --url "https://news.ycombinator.com" | ||
|
|
||
| # Click on a link | ||
| browser-use click --selector ".titleline a" | ||
|
|
||
| # Take a screenshot | ||
| browser-use screenshot --output page.png | ||
|
|
||
| # Extract page title with JavaScript | ||
| browser-use js --code "document.title" | ||
| ``` | ||
|
|
||
| ### Authentication with cookies | ||
|
|
||
| Save and restore login state: | ||
|
|
||
| ```bash | ||
| # Navigate and log in manually or with agent | ||
| browser-use agent --task "Log in to example.com with username demo" | ||
|
|
||
| # Export cookies for later use | ||
| browser-use cookies export --output auth-cookies.json | ||
|
|
||
| # In a new session, restore cookies | ||
| browser-use cookies import --input auth-cookies.json | ||
| browser-use navigate --url "https://example.com/dashboard" | ||
| ``` | ||
|
|
||
| ### Cloud-based automation | ||
|
|
||
| Run tasks in the cloud: | ||
|
|
||
| ```bash | ||
| # Create a cloud session with a profile | ||
| browser-use cloud create --profile "authenticated-user" | ||
|
|
||
| # Run an agent task in the cloud | ||
| browser-use agent --task "Extract data from dashboard" --cloud | ||
| ``` | ||
|
|
||
| ## Environment variables | ||
|
|
||
| | Variable | Description | | ||
| |----------|-------------| | ||
| | `BROWSER_USE_API_KEY` | API key for cloud features | | ||
| | `BROWSER_USE_HEADLESS` | Run browser in headless mode (`true`/`false`) | | ||
| | `BROWSER_USE_PROFILE` | Default profile to use | | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P0: This page documents a CLI command surface that does not match the published Browser Use CLI, so readers will copy commands that do not exist.
Prompt for AI agents