Metadata-Version: 2.4
Name: X5Browser
Version: 4.0.4
Summary: A full Chrome browser automation library for Python, powered by Chrome DevTools Protocol.
Author: X5Coder
License-Expression: MIT
Project-URL: Homepage, https://github.com/X5Coder/X5Browser
Project-URL: Repository, https://github.com/X5Coder/X5Browser
Project-URL: Issues, https://github.com/X5Coder/X5Browser/issues
Keywords: browser,chrome,cdp,automation,ai-agent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: websockets<18,>=12
Requires-Dist: mss<11,>=9; sys_platform == "linux"
Requires-Dist: Pillow<13,>=10; sys_platform == "linux"
Dynamic: license-file

<p align="center">
  <img src="Google.svg" width="120" alt="X5Browser">
</p>

<h1 align="center">X5Browser</h1>

<p align="center">
  <img src="https://img.shields.io/badge/version-v4.0.4-blue" alt="Version v4.0.4">
  <img src="https://img.shields.io/badge/python-%3E%3D3.10-green" alt="Python >= 3.10">
</p>

<p align="center"><b>Version v4.0.4</b></p>

A reusable Python browser automation library that gives projects control of Chrome through the Chrome DevTools Protocol (CDP). It includes 37 agent tools, automatic browser setup, and diagnostics.

The complete agent tool catalog is available at `Tools/tools.json`.
Agents should load the system skill and this catalog once at task start, then
reuse one browser/CDP session and verify each action before proceeding.

## Tutorial Video

Watch the full walkthrough on YouTube:

[![X5Browser Tutorial](https://img.youtube.com/vi/gSuG9tmgOD8/maxresdefault.jpg)](https://youtu.be/gSuG9tmgOD8)

## Requirements

- Python 3 >= 3.10
- Internet connection (Chrome is downloaded automatically if it is not installed)

On Linux, `request_human_takeover` streams the **full X11 desktop** (including
Chrome tabs and browser controls) and forwards user input. Linux installs pull
in the required Python capture/encoding libraries. You also need `xdotool` and
`x11-utils`; a display-less server additionally needs `xvfb`, `openbox`, and
`xauth`. See the [Linux desktop setup](docs/USER_GUIDE.md#native-linux-desktop-takeover).

## Install as a Python library

```bash
python -m pip install X5Browser
```

Python 3.10 or newer and Google Chrome are required. Check your environment
with `python -m X5Browser.doctor --report`; use `--fix` when you want the
doctor to install the managed Chrome build if needed.

Import the library from any Python project:

```python
import asyncio
from X5Browser import BrowserConfig, X5Browser

async def main():
    async with X5Browser(BrowserConfig.default()) as browser:
        result = await browser.navigate_page("https://example.com")
        print(result)

asyncio.run(main())
```

`BrowserConfig.default()` uses the project's `Settings/settings.json` when
present. Otherwise, it creates settings and browser data under
`.x5browser/` in the current project. Set `X5BROWSER_HOME` to choose another
project data directory. The agent tool catalog is available in the installed
package at `X5Browser/Tools/tools.json`.
The unified AI system prompt and maintenance command definitions are also
included under `X5Browser/System_Prompt/skills/` and
`X5Browser/System_Commands/`.

For developer setup, Python examples, and explanations of all 37 browser tools,
see the [X5Browser User Guide](docs/USER_GUIDE.md). The guide is also included
in the installed package at `X5Browser/docs/USER_GUIDE.md`.

### Install the standalone manager

Open **PowerShell** and run:

```powershell
python -m pip install X5Browser
x5browser --help
x5browser start
```

The `x5browser` command also supports `stop` and `install`.

### Update

Upgrade with `python -m pip install --upgrade X5Browser`.

## Usage

From the project folder:

```powershell
cd $env:USERPROFILE\X5Browser
```

**Start**

```powershell
x5browser start
```

**Stop**

```powershell
x5browser stop
```

Start X5Browser once per task and keep the same CDP session for each browser
action. Use `browser_session` with `status` to inspect the current session.
For the standard Chrome profile, open `chrome://inspect/#remote-debugging`,
enable Remote Debugging, then approve Chrome's Allow dialog. X5Browser reads
Chrome's `DevToolsActivePort` and attaches without closing or relaunching the
profile. Stop detaches X5Browser; disable Remote Debugging in Chrome to revoke
future connection requests.

## Credits

Created and maintained by [X5Coder](https://github.com/X5Coder) · [github.com/X5Coder/X5Browser](https://github.com/X5Coder/X5Browser)

© X5Coder. All rights reserved.
