Backend Development 5 min read

Introducing DrissionPage: A Python Web Automation Library Combining Browser Control and Requests

DrissionPage is a Python-based web automation library that merges browser-driven interaction with high‑efficiency request handling, offering a fast, driver‑free, and feature‑rich alternative to Selenium for tasks such as scraping, element searching, and full‑page screenshots.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Introducing DrissionPage: A Python Web Automation Library Combining Browser Control and Requests

DrissionPage is a Python web automation tool that can control browsers and send/receive network packets, combining the convenience of browser automation with the speed of the requests library. Its concise, elegant syntax makes it beginner‑friendly.

Background : Using requests for data collection on sites requiring login often involves complex request construction, captcha handling, and JavaScript obfuscation, leading to low development efficiency. Browsers can bypass many obstacles but are slower. DrissionPage was created to unite both approaches, enabling rapid development and fast execution, while providing high‑level page‑oriented APIs that hide low‑level details.

Initially built as a Selenium wrapper, the library was rewritten from version 3.0 onward to remove Selenium dependencies, improve functionality, and boost performance.

Core Capabilities (compared with Selenium):

No WebDriver fingerprints.

No need to download drivers for different browser versions.

Higher execution speed.

Cross‑iframe element search without switching contexts.

Treat iframes as normal elements, simplifying logic.

Operate multiple browser tabs simultaneously, even when inactive.

Directly read browser cache to save images without GUI interaction.

Capture full‑page screenshots, including off‑viewport areas (supported in Chrome 90+).

Handle non‑open shadow‑root elements.

Getting Started Demo : The library provides SessionPage and WebPage objects. SessionPage uses a requests session and POM‑style HTML parsing, allowing packet‑level access while keeping page‑like operations simple.

<code># Import
from DrissionPage import SessionPage
# Create page object
page = SessionPage()
# Visit a URL
page.get('https://gitee.com/explore/all')
# Find elements
items = page.eles('t:h3')
# Iterate and print link text and href
for item in items[:-1]:
    lnk = item('tag:a')
    print(lnk.text, lnk.link)
</code>

The example prints the text and URL of each &lt;h3&gt; heading's link on the Gitee explore page. Screenshots in the original article show the script output and a comparison with the actual website.

At the end of the article, readers are invited to scan a QR code to receive a free Python public‑course bundle containing e‑books, tutorials, project resources, and source code.

requestsWeb Automationselenium-alternativedrissionpagescraping
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.