Skip to main content

CDP-Patches v1.0

PyPI PyPI

Install it from PyPI

pip install cdp-patches
Or for Full Linting

(Includes: playwright, botright, selenium, selenium_driverless)

pip install cdp-patches[automation_linting]

Leak Patches

Input Package

Concept: Input Domain Leaks

Bypass CDP Leaks in Input domains

Brotector Banner

For an interaction event e, the page coordinates won't ever equal the screen coordinates, unless Chrome is in fullscreen. However, all CDP input commands just set it the same by default (see crbug#1477537).

var is_bot = (e.pageY == e.screenY && e.pageX == e.screenX)
if (is_bot && 1 >= outerHeight - innerHeight){ // fullscreen
    is_bot = false
}

Furthermore, CDP can't dispatch CoalescedEvent's (demo).

As we don't want to patch Chromium itsself, let's just dispatch this event at OS-level!


Usage

from cdp_patches.input import SyncInput

sync_input = SyncInput(pid=pid)
# Or
sync_input = SyncInput(browser=browser)

# Dispatch Inputs
sync_input.click("left", 100, 100)  # Left click at (100, 100)
sync_input.double_click("left", 100, 100)  # Left double-click at (100, 100)
sync_input.down("left", 100, 100)  # Left mouse button down at (100, 100)
sync_input.up("left", 100, 100)  # Left mouse button up at (100, 100)
sync_input.move(100, 100)  # Move mouse to (100, 100)
sync_input.scroll("down", 10)  # Scroll down by 10 lines
sync_input.type("Hello World!")  # Type "Hello World!"

Async Usage

import asyncio

from cdp_patches.input import AsyncInput

async def main():
    async_input = await AsyncInput(pid=pid)
    # Or
    async_input = await AsyncInput(browser=browser)
    
    # Dispatch Inputs
    await async_input.click("left", 100, 100)  # Left click at (100, 100)
    await async_input.double_click("left", 100, 100)  # Left double-click at (100, 100)
    await async_input.down("left", 100, 100)  # Left mouse button down at (100, 100)
    await async_input.up("left", 100, 100)  # Left mouse button up at (100, 100)
    await async_input.move(100, 100)  # Move mouse to (100, 100)
    await async_input.scroll("down", 10)  # Scroll down by 10 lines
    await async_input.type("Hello World!")  # Type "Hello World!"

if __name__ == '__main__':
    asyncio.run(main())

TODO

  • Improve mouse movement timings.
  • Implement extensive testing.

Owner: Vinyzu

Co-Maintainer: Kaliiiiiiiiii

Read the Documentation


Development

Read the CONTRIBUTING.md file.


© Vinyzu

GNU GPL

(Commercial Usage is allowed, but source, license and copyright has to made available. Botright does not provide and Liability or Warranty)


Authors

Vinyzu, Kaliiiiiiiiii

Metadata

Release files for cdp-patches-plus 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdp-patches-plus 0.1.1
File Size Uploaded Provenance Actions
cdp_patches_plus-0.1.1.tar.gz 38.5 kB Without provenance Details for cdp_patches_plus-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cdp-patches-plus 0.1.1
File Interpreter ABI Platform Actions
cdp_patches_plus-0.1.1-py3-none-any.whl Python 3 none any Details for cdp_patches_plus-0.1.1-py3-none-any.whl

Total release size: 71.3 kB

Release files / cdp_patches_plus-0.1.1.tar.gz

Download URL cdp_patches_plus-0.1.1.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f7bd87d6f1febc25670ef0e7a2c205dadcba64305e00943dde5277d37d046b72
BLAKE2b-256 checksum
How to use checksums
bf752245792243c2ec4e482f0d5cc03a14d609e6a55796631e95ddb57228b4b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / cdp_patches_plus-0.1.1-py3-none-any.whl

Download URL cdp_patches_plus-0.1.1-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
495becfd658cb8d881d06108a0e09a963d7810857c406df58a347799e1c7fc57
BLAKE2b-256 checksum
How to use checksums
ecd96c026a4a7da8f60981b0fa3acd0ac6cf70ad3f48755377c594552014ffcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for cdp-patches-plus 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page