Skip to main content

Ignores all ChromeDriver Exceptions, returns the Exception(s) as string

Project description

Ignores all ChromeDriver Exceptions, returns the Exception(s) as string

# Tested with:
# https://github.com/ultrafunkamsterdam/undetected-chromedriver
# Python 3.9.13
# Windows 10


$pip install a-selenium-errorhandler

from auto_download_undetected_chromedriver import download_undetected_chromedriver
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By

from a_selenium_errorhandler import add_ignore_exception


if __name__ == "__main__":
    folderchromedriver = "f:\\seleniumdriver2"
    path = download_undetected_chromedriver(
        folder_path_for_exe=folderchromedriver, undetected=True
    )
    driver = uc.Chrome(driver_executable_path=path)
    driver = add_ignore_exception(driver)

    # You can check if an executed command threw an Exception
    e1 = driver.find_element(By.CSS_SELECTOR, "not existing")
    if isinstance(e1, str):
        print("failed")
    else:
        print(e1)
        print("success")
    print("------------------")
    e1 = driver.find_element(By.CSS_SELECTOR, "*")
    if isinstance(e1, str):
        print("failed")
    else:
        print(e1)
        print("success")

Project details


Release history Release notifications | RSS feed

This version

0.10

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a_selenium_errorhandler-0.10.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

a_selenium_errorhandler-0.10-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page