DrissionPage

4.1.1.2 · active · verified Thu Apr 16

DrissionPage is a Python-based web automation tool that efficiently combines browser control functionalities (similar to Playwright or Selenium) with high-performance data packet handling (akin to Requests). It provides a unified and user-friendly API for tasks like web scraping, automated testing, and general web interaction, allowing seamless transitions between full browser and headless HTTP modes. The library is actively maintained, currently at version 4.1.1.2, and aims for a balance of power, elegance, and ease of use, with a development cadence that includes frequent updates and feature enhancements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `ChromiumPage` instance, navigate to a URL, extract the page title and an element's text, and then close the browser. It showcases the core browser automation capabilities.

from DrissionPage import ChromiumPage

# Initialize a browser page (Chromium is default)
page = ChromiumPage()

# Navigate to a website
page.get('https://www.example.com')

# Print the title of the page
print(f"Page Title: {page.title}")

# Find an element by CSS selector and get its text
element = page.ele('css:h1')
if element:
    print(f"H1 Text: {element.text}")

# Close the browser
page.quit()

view raw JSON →