Skip to main content

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

llama_index_tools_playwright-0.4.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

llama_index_tools_playwright-0.4.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_playwright-0.4.0.tar.gz.

File metadata

  • Download URL: llama_index_tools_playwright-0.4.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_playwright-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2b6f9ed2fdf5c11e712b69c5919b29dfffc6b0340f06be563224939f8fe781a6
MD5 a5b827e0315399a96f40ebf87f5dab97
BLAKE2b-256 b5a172b199929b391a1997bad5b75ef857703a0e5c053cf851ac67d29eda6d35

See more details on using hashes here.

File details

Details for the file llama_index_tools_playwright-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_tools_playwright-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_tools_playwright-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fc2151aab9cb7230b8a2eb6059878090828c448318f0c06cbc1f7e0ca20c5df
MD5 ac30298fcb0a1e455d6b6ad8b7c9b7d4
BLAKE2b-256 6b452355b6e120f2415fa8bab6fe5ab62811366bca0c29d91b3f352bd567d10f

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