Skip to main content

threadingwebdriver

Selenium headless webdriver using two threadpools.
ThreadPool(1) for control browser.
ThreadPool(custom_number) for read page(ex: get WebElement).
Chrome only.

Initialize

import threadingwebdriver
driver = threadingwebdriver.ChromeWebdriver()
driver.initialize()

Close

Close driver. It will wait tasks of ThreadPools are finish.

driver.close()

Open URL (Async)

url = 'https://www.google.com/'
driver.open_async(url)

Open URL (Sync)

url = 'https://www.google.com/'
is_open:bool = driver.open(3, url)

Get Element (Async)

url = 'https://www.google.com/'
driver.open_async(url)

timeout = 3
body_xpath = '/html/body'
body_xpath_result:WebElementAsyncResult = driver.get_element_xpath_async(timeout, body_xpath)
# code...
body:WebElement = body_xpath_result.get()

Concurrency

import threadingwebdriver
driver = threadingwebdriver.ChromeWebdriver()
driver.initialize(read_thread_count = 3)
timeout = 2
url = "Input Your URL"
driver.open(timeout, url)

p_async = driver.get_element_xpath_async(timeout, '/html/body/div/p')
a_async = driver.get_element_xpath_async(timeout, '/html/body/div/a')
div_async = driver.get_element_xpath_async(timeout, '/html/body/div')

p = p_async.get()
a = a_async.get()
div = div_async.get()

Get Element (Sync)

timeout = 3
body_xpath = '/html/body'
body:WebElement = driver.get_element_xpath(timeout, body_xpath)

Initialize Websocket Listener

async def websocket_listener(listener):
    async for event in listener:
        payload_data = event.response.payload_data
        print(payload_data)

import threadingwebdriver
driver = threadingwebdriver.ChromeWebdriver()
driver.initialize(websocket_listening_function=websocket_listener)

url = 'https:// Input Your URL'
driver.open(3, url)

Exceptions

Based on thread order.

url1 = 'https://www.google.com/'
url2 = 'https://www.github.com/'
driver.open_async(url1)
driver.open_async(url2)
timeout = 3
body_xpath = '/html/body'
body_xpath_result:WebElementAsyncResult = driver.get_element_xpath_async(timeout, body_xpath) 
# Exception: if run 'get_element_xpath_async()' before run 'open_async(url2)'.
url1 = 'https://www.google.com/'
url2 = 'https://www.github.com/'
driver.open_async(url1)
timeout = 3
body_xpath = '/html/body'
body_xpath_result:WebElementAsyncResult = driver.get_element_xpath_async(timeout, body_xpath)
driver.open_async(url2) 
# Exception: run 'open_async(url2)' if not finish 'get_element_xpath_async()'.

Metadata

Release files for threadingwebdriver 0.0.3

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

Source distribution (sdist)

Source distribution for threadingwebdriver 0.0.3
File Size Uploaded Provenance Actions
threadingwebdriver-0.0.3.tar.gz 7.6 kB Without provenance Details for threadingwebdriver-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for threadingwebdriver 0.0.3
File Interpreter ABI Platform Actions
threadingwebdriver-0.0.3-py3-none-any.whl Python 3 none any Details for threadingwebdriver-0.0.3-py3-none-any.whl

Total release size: 14.6 kB

Release files / threadingwebdriver-0.0.3.tar.gz

Download URL threadingwebdriver-0.0.3.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e1d45644b6330c1a73b6a40f498dec58970cf645e6d33b27a46a0acdb8e762c4
BLAKE2b-256 checksum
How to use checksums
13deca3469e1ab9c4ebd9cc0bfec26c689ad6cd0f5e772c93712cde810512e00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / threadingwebdriver-0.0.3-py3-none-any.whl

Download URL threadingwebdriver-0.0.3-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5b1767a16232b2fd779245127296582aef7215fce23e28365559827b448a582
BLAKE2b-256 checksum
How to use checksums
7ed16fb3ad3a8cbcfd53d5dd5f9289d10b79062be2790d379a5a6c21715e41c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Security for threadingwebdriver 0.0.3

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.

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