Registry / testing / selenium

selenium

JSON →
library4.47.0pypypi✓ verified 24d ago

Python bindings for Selenium WebDriver — browser automation for Chrome, Firefox, Edge, Safari. Current version is 4.41.0 (Feb 2026). Requires Python >=3.10. Selenium Manager (built-in since 4.6) automatically downloads and manages browser drivers — manual chromedriver management is no longer needed. All find_element_by_*() shorthand methods were removed in Selenium 4.

pip install selenium
INSTALL
IMPORT
SIG · SELENIUM
S
selenium
testingpythonv4.47.0
Install
4.2s avg
Import
Disk
53MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.47.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 53.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.2s · import 0.000s · 54MB
53MB installed
● package 53MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

webdriver
import selenium
from selenium import webdriver
By
from selenium.webdriver.common.by import By
WebDriverWait
from selenium.webdriver.support.ui import WebDriverWait

Modern Selenium 4 pattern. Selenium Manager handles chromedriver. Always use WebDriverWait.

from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.options import Options # Selenium Manager downloads chromedriver automatically options = Options() options.add_argument('--headless=new') # new headless mode options.add_argument('--no-sandbox') options.add_argument('--disable-dev-shm-usage') driver = webdriver.Chrome(options=options) try: driver.get('https://example.com') # Wait for element before interacting wait = WebDriverWait(driver, timeout=10) button = wait.until( EC.element_to_be_clickable((By.ID, 'submit-btn')) ) button.click() # Find elements items = driver.find_elements(By.CSS_SELECTOR, '.product-item') print(f'Found {len(items)} items') finally: driver.quit()
Debug
Known issues
breakingAll find_element_by_*() shorthand methods removed in Selenium 4. driver.find_element_by_id(), find_element_by_xpath(), find_element_by_css_selector(), find_elements_by_class_name() etc. all raise AttributeError. Still the most common LLM-generated Selenium footgun.
fix
Replace find_element_by_id('x') with find_element(By.ID, 'x'). Replace find_element_by_css_selector('.x') with find_element(By.CSS_SELECTOR, '.x'). Import: from selenium.webdriver.common.by import By
affects: >= 4.0
breakingPython 3.9 dropped in Selenium 4.33+. Now requires Python >=3.10.
fix
Pin selenium<4.33 for Python 3.9 environments.
affects: >= 4.33
breakingdesired_capabilities parameter deprecated and removed from WebDriver constructors. Passing desired_capabilities= raises TypeError in modern Selenium 4.
fix
Use Options objects instead: options = ChromeOptions(); options.set_capability('key', 'value'). Pass options= to the WebDriver constructor.
affects: >= 4.0
breakingoptions.add_argument('--headless') (old Chrome headless) deprecated. Chrome switched to a new headless implementation — use --headless=new instead.
fix
Replace --headless with --headless=new in ChromeOptions. The new headless renders pages more like a real browser.
affects: >= 4.8 with Chrome 112+
gotchaSelenium Manager automatically downloads matching browser drivers since 4.6. Manually downloading chromedriver and putting it on PATH is no longer necessary — but if you have a stale chromedriver on PATH, it may conflict with Selenium Manager.
fix
Remove manually downloaded chromedriver from PATH and let Selenium Manager handle it. Or pin a specific driver version via Service(executable_path='...').
affects: >= 4.6
gotchaNot using WebDriverWait causes flaky tests. Immediately calling find_element() after page navigation often fails because the element hasn't loaded yet.
fix
Always use WebDriverWait with expected_conditions: wait = WebDriverWait(driver, 10); element = wait.until(EC.presence_of_element_located((By.ID, 'element-id')))
affects: all
gotchadriver.quit() must be called to close the browser process. Using driver.close() only closes the current window but leaves the browser process running. Always use try/finally or context manager.
fix
Use try/finally: try: ... finally: driver.quit(). Or use with statement with a context manager wrapper.
affects: all
Upgrade
Version history
4.47.0latest on PyPI · released Aug 10, 2026
Audit
Dependencies
urllib3requiredRequired. Installed automatically.
triorequiredRequired for async support. Installed automatically.
certifirequiredRequired. Installed automatically.
Agent activity
14 hits · last 30 days
node
12
Amazon
1
Resources
selenium — pip install selenium · libregistry