Skip to main content

CLI tool for browser automation tasks

Project description

Browser Use CLI

A command-line tool for browser automation tasks using LLMs.

Prerequisites

Installation

Setup

  1. Clone this repository:

    git clone https://github.com/sanjeed5/browser-use-cli.git
    cd browser-use-cli
    
  2. Install uv if you don't have it already:

    curl -sSf https://install.python-uv.org | python3
    
  3. Create and activate a virtual environment (recommended):

    uv venv --python 3.11
    # For Mac/Linux:
    source .venv/bin/activate
    # For Windows:
    .venv\Scripts\activate
    
  4. Install the package:

    Using uv (recommended):

    uv pip install -e .
    

    Or using pip:

    pip install -e .
    
  5. Run the setup command to configure your environment:

    browser-setup
    

    This will:

    • Check for required dependencies and install them if needed
    • Verify Chrome browser installation
    • Set up your Google API key
    • Install Playwright browsers

Getting a Google API Key

To use this application, you need a Google API key for the Gemini model:

  1. Visit https://aistudio.google.com/apikey
  2. Create a new API key
  3. Add the API key to your .env file or enter it when prompted

Testing Installation

To verify if the installation will work properly on your system or someone else's laptop, we've provided testing tools:

Quick Verification

Run the verification script to check all prerequisites:

python -m browser_use_starter.verify_setup

Complete Installation Test

For a comprehensive test that verifies all components:

  • On Unix/macOS:

    chmod +x scripts/test_installation.sh
    ./scripts/test_installation.sh
    
  • On Windows:

    scripts\test_installation.bat
    

For detailed testing instructions, see docs/TESTING.md.

Usage

Once installed, you can run browser tasks from anywhere in your terminal:

# Run with a specific task
browser-task "Go to google.com and search for the weather in New York"

# Run with the default example task
browser-task

# Run in headless mode (browser not visible)
browser-task --headless "Go to google.com and search for the weather"

# Enable debug logging
browser-task --debug "Your task here"

Direct Module Execution

You can also run the agent module directly:

# Using uv (recommended)
uv run -m browser_use_starter.agent "Compare the price of gpt-4o and DeepSeek-V3"

# Using python
python -m browser_use_starter.agent "Compare the price of gpt-4o and DeepSeek-V3"

# Without specifying a task (uses default example)
python -m browser_use_starter.agent

Examples

Here are some example tasks you can try:

  • browser-task "Go to amazon.com and search for wireless headphones under $100"
  • browser-task "Go to youtube.com and find the most popular video about machine learning"
  • browser-task "Go to wikipedia.com and find information about the Eiffel Tower"
  • browser-task "Compare the price of gpt-4o and DeepSeek-V3"

Environment Variables

Create a .env file in the root directory with the following variables:

GOOGLE_API_KEY=your_api_key_here

The application will prompt you to enter the API key if it's not found in the environment variables.

Features

  • Automatic dependency checking and installation
  • Chrome browser detection
  • Secure API key management
  • Seamless browser automation using LLMs
  • Headless mode support
  • Detailed logging

Configuration

API keys are stored securely in your user configuration directory:

  • Linux/macOS: ~/.config/browser-use-cli/api_keys.env
  • Windows: %USERPROFILE%\.config\browser-use-cli\api_keys.env

Troubleshooting

  • Make sure Google Chrome is installed on your system
  • Ensure all required packages are installed
  • Check that your Google API key is valid and has access to the Gemini model
  • If you encounter issues, refer to the Browser Use documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browser_use_cli-0.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browser_use_cli-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file browser_use_cli-0.1.0.tar.gz.

File metadata

  • Download URL: browser_use_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for browser_use_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf06af8c67522858e4a7401f0b2dad378d6e2c107741a6f7383ef181e6517659
MD5 57dd502a643844a23e6e31731eced099
BLAKE2b-256 962b4226f311c34d8c6c25438bfe7335fb0c438bd503077f155ff2d35624244d

See more details on using hashes here.

File details

Details for the file browser_use_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for browser_use_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07d2da347fd5386c4056e612f2a807f1634bdfbc957c68b2a180ff49c716f0c6
MD5 ff78f3de0901b326c1cfe4c43c9192e1
BLAKE2b-256 bed0b5e0c67b261dfd41eed715d96fa05f4b6876fbc85afcc355db21f8fa058a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page