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.
Installation
pip install llama-index-tools-playwright
Setup
In order to use this tool, you need to have a sync Playwright browser instance. You can hook one up by running the following code:
browser = PlaywrightToolSpec.create_sync_playwright_browser(headless=False)
playwright_tool = PlaywrightToolSpec.from_sync_browser(browser)
Usage
Navigate to a website
playwright_tool.navigate_to("https://playwright.dev/python/docs/intro")
Get current page URL
playwright_tool.get_current_page()
Extract all hyperlinks
playwright_tool.extract_hyperlinks()
Extract all text
playwright_tool.extract_text()
Get element attributes
element = playwright_tool.get_elements(
selector="ELEMENT_SELECTOR", attributes=["innerText"]
)
Click on an element
playwright_tool.click(selector="ELEMENT_SELECTOR")
Fill in an input field
playwright_tool.fill(selector="ELEMENT_SELECTOR", value="Hello")
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.1.0.tar.gz.
File metadata
- Download URL: llama_index_tools_playwright-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50176098d4e0e764a1824be762433d4dd6c28cc718d7896371eda6d9479e1613
|
|
| MD5 |
41a8c6a1470667fe575278238c64e9bc
|
|
| BLAKE2b-256 |
94209cd0e44fb4d114399a52209a16f26c67b006feb484d71aa6b5fd09b2f9c8
|
File details
Details for the file llama_index_tools_playwright-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_playwright-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
721edf8f0d217183951875463762ef8ed55f26ee7b8a02d831f54ad791bbda00
|
|
| MD5 |
61580af919b13384ead55f664951b352
|
|
| BLAKE2b-256 |
01f29c3f9eecfae2ed7bd82fb6f90caa9c901193e555c1e09f30f158a4cdc648
|