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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file a_selenium_errorhandler-0.10.tar.gz
.
File metadata
- Download URL: a_selenium_errorhandler-0.10.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cb7c97a80ba0d3367dac3f383947846b9d386b2329abe82f000f7ed98fb99ee |
|
MD5 | 5069e1b3efbc3d2efe382b55f7eb3e74 |
|
BLAKE2b-256 | d17f6f62148da0e73c8589c93f48c6de32ae714d98e4b9c3b05c16f1e20e26a7 |
File details
Details for the file a_selenium_errorhandler-0.10-py3-none-any.whl
.
File metadata
- Download URL: a_selenium_errorhandler-0.10-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d0bb644fbfb66125f5464d65d5a2e00765ef3de8578260917ce2563351b4b13 |
|
MD5 | 51b470e1fd41959224f6592f77aee61c |
|
BLAKE2b-256 | b195aafed1d6651d7aa09b8dcab059f8167024245a979802c2b875d8363ef553 |