llama-index tools playwright integration
Project description
Playwright Browser Tool
This tool is a wrapper around the Playwright library. It allows you to navigate to a website, extract text and hyperlinks, and click on elements.
Warning Only support async functions and playwright browser APIs.
Installation
pip install llama-index-tools-playwright
Setup
In order to use this tool, you need to have a async Playwright browser instance. You can hook one up by running the following code:
browser = await PlaywrightToolSpec.create_async_playwright_browser(
headless=False
)
playwright_tool = PlaywrightToolSpec.from_async_browser(browser)
Usage
Navigate to a website
await playwright_tool.navigate_to("https://playwright.dev/python/docs/intro")
Navigate back
await playwright_tool.navigate_back()
Get current page URL
await playwright_tool.get_current_page()
Extract all hyperlinks
await playwright_tool.extract_hyperlinks()
Extract all text
await playwright_tool.extract_text()
Get element attributes
element = await playwright_tool.get_elements(
selector="ELEMENT_SELECTOR", attributes=["innerText"]
)
Click on an element
await playwright_tool.click(selector="ELEMENT_SELECTOR")
Fill in an input field
await playwright_tool.fill(selector="ELEMENT_SELECTOR", value="Hello")
Agentic Usage
This tool has a more extensive example usage documented in a Jupyter notebook here
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_tools_playwright-0.3.0.tar.gz.
File metadata
- Download URL: llama_index_tools_playwright-0.3.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bf4c793035c8f7c084d327e4862c25b72d584ba3b3d0185fb48f572de4acca2
|
|
| MD5 |
1749f318f814439624cbf259ba6d2ff3
|
|
| BLAKE2b-256 |
409f3d4bb675ddd48734a50e399fba69d4d9f572f327713a4bf5ee6665c8200c
|
File details
Details for the file llama_index_tools_playwright-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_playwright-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48487568066a30fd33ad69823273a103d0243afad866df71aab3b481ef3b57bf
|
|
| MD5 |
ce19b2d8cd8b08e027af73e33b0c2199
|
|
| BLAKE2b-256 |
d0ea14c03c6579a396de3c46780adbf78c10bffb29d7cb2a7f519959f57bfff5
|