playwrightvsskyvern
playwright is a Python package that allows developers to automate web browsers for end-to-end testing, web scraping, and web performance analysis. It is built on top of WebKit, Mozilla's Gecko, and Microsoft's EdgeHTML, and it is designed to be fast, reliable, and easy to use.
playwright is similar to Selenium, but it provides a more modern and powerful API, with features such as automatic waiting for elements, automatic retries, and built-in support for browser contexts, which allow you to open multiple pages in a single browser instance.
Playwright also provides an asynchronous client which makes scaling playwright-powered web scrapers easier than alternatives (like Selenium)
Skyvern is an AI-powered browser automation tool that uses large language models (LLMs) and computer vision to interact with websites. Instead of relying on DOM selectors, Skyvern takes screenshots of web pages and uses visual understanding to identify and interact with elements, making it highly resilient to website changes.
Key features include:
- Vision-based interaction Uses screenshots and computer vision (multimodal LLMs) to understand page layout and identify interactive elements visually, rather than through DOM inspection alone.
- No selectors needed Describe tasks in natural language and Skyvern figures out what to click, type, and navigate without CSS selectors or XPath.
- Complex workflow automation Can handle multi-step workflows like form filling, navigation through menus, file uploads, and multi-page processes.
- Self-correcting When actions fail, Skyvern can analyze the resulting page state and adjust its approach, recovering from errors autonomously.
- API-first design Provides a REST API for triggering and managing automation tasks programmatically.
- Open source with cloud option Core engine is open source and can be self-hosted. Also available as a managed cloud service.
Skyvern is particularly effective for automating tasks on websites with complex or dynamic UIs where traditional selector-based automation breaks frequently. It achieved 85.85% accuracy on the WebVoyager benchmark.
Highlights
Example Use
from playwright import sync_playwright
# Start Playwright
with sync_playwright() as playwright:
# Launch a browser instance
browser = playwright.chromium.launch()
# Open a new context (tab)
context = browser.new_context()
# Create a new page in the context
page = context.new_page()
# Navigate to a website
page.goto("https://www.example.com")
# Find an element by its id
element = page.get_by_id("example-id")
# Interact with the element
element.click()
# Fill an input form
page.get_by_name("example-name").fill("example text")
# Find and click a button
page.get_by_xpath("//button[text()='Search']").click()
# Wait for the page to load
page.wait_for_selector("#results")
# Get the page title
print(page.title)
# Close the browser
browser.close()
import requests
# Skyvern runs as a service - interact via REST API
SKYVERN_API = "http://localhost:8000/api/v1"
# Create a task with natural language instructions
task = requests.post(
f"{SKYVERN_API}/tasks",
json={
"url": "https://example.com/contact",
"navigation_goal": "Fill out the contact form with test data and submit it",
"data_extraction_goal": "Extract the confirmation message after submission",
"navigation_payload": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello, this is a test message",
},
},
).json()
task_id = task["task_id"]
# Check task status
result = requests.get(f"{SKYVERN_API}/tasks/{task_id}").json()
print(result["status"]) # "completed"
print(result["extracted_information"]) # confirmation message