Skip to main content

asyncselenium Package

  1. This is a tools and libraries enabling web browser automation.
  2. it makes selenium to be async, and improve the performance!
  3. the useage is the same to selenium to make it easy to use.

you can simply install or upgrade:

pip install -U asyncselenium

if you already make the remote driver running (use the default port 4444):

.. code-block:: python

import asyncio

from selenium import webdriver
from selenium.webdriver.common.by import By
from asyncselenium.webdriver.remote.async_webdriver import AsyncWebdriver
from asyncselenium.webdriver.support.async_wait import AsyncWebDriverWait
from asyncselenium.webdriver.support import async_expected_conditions as ec

async def test_get():
    chrome_options = webdriver.ChromeOptions()
    browser = await AsyncWebdriver(options=chrome_options)
    wait = AsyncWebDriverWait(browser, 20)
    await browser.get('https://www.baidu.com')
    ele = await wait.until(ec.presence_of_element_located((By.XPATH, '//*[@id="su"]')))
    search = await wait.until(ec.presence_of_element_located((By.XPATH, '//*[@id="kw"]')))
    await search.send_keys('python')
    print(await ele.tag_name)
    await asyncio.sleep(3)
    await browser.quit()

asyncio.run(test_get())

.. code-block:: python

import asyncio
import sys
sys.path.append('.')
from selenium.webdriver.chrome import service
from asyncselenium.webdriver.chrome.async_webdriver import WebDriver

driver_path = ''
async def test_get():
    browser = await WebDriver(driver_path)
    await browser.get('https://www.baidu.com')
    await asyncio.sleep(5)
    await browser.quit()

async def test_multi_browser():
    service = WebDriver.get_service(driver_path)
    browser = await WebDriver(driver_path, service=service)
    await browser.get('https://www.baidu.com')
    browser2 = await WebDriver(driver_path, service=service)
    await browser2.get('https://news.baidu.com')
    await asyncio.sleep(5)
    await browser.quit(stop_service=False)
    await browser2.get('https://www.baidu.com')
    await asyncio.sleep(5)
    await browser2.quit()

asyncio.run(test_multi_browser())

Release files for asyncselenium 0.0.2

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

Source distribution (sdist)

Source distribution for asyncselenium 0.0.2
File Size Uploaded
asyncselenium-0.0.2.tar.gz 24.7 kB Details

Built distribution (wheel)

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

Total release size: 54.0 kB

Release files / asyncselenium-0.0.2.tar.gz

Download URL asyncselenium-0.0.2.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
af37f60fa618e408f6db658002f6276d4810beca31fb8b381e0e729b6c6851b0
BLAKE2b-256 checksum
How to use checksums
066ead5359f256291427dad4cfdaf642e126fa80fece900dbd1a3e2ad304b966
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release files / asyncselenium-0.0.2-py3-none-any.whl

Download URL asyncselenium-0.0.2-py3-none-any.whl
Size 29.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28ad21280151cff3b7680cbaf0e871a091b271d8e2e7f7d286223d9475b05d0b
BLAKE2b-256 checksum
How to use checksums
bde7fe9bd569d4efe76736e2bf892065d612a8237ce35aee71180d9315c96c8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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