Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Selenium lets Python control a real browser: install the Python package, start a browser with WebDriver, identify elements with locators, and wait for the page state your next action depends on. For a first local Chrome script, use webdriver.Chrome(); current Selenium releases include Selenium Manager, which can usually obtain a missing browser driver. You do not need a Java server for local scripts.

What Selenium, Python, WebDriver, and the browser each do

  • Selenium provides the browser-automation interface.
  • Python is the language your script uses to issue commands and check results.
  • WebDriver connects Selenium commands to a browser implementation.
  • The browser loads and renders the site and performs actions such as clicking and typing.

For local exercises, Selenium’s Python API can drive Chrome, Edge, Firefox, Safari, WebKitGTK, and WPEWebKit, as well as remote sessions. Browser availability and setup depend on your operating system and configuration. Selenium Manager can download Chrome, Firefox, and Edge browser builds in supported configurations; that is a narrower set than the Python API’s listed browser support. Selenium Python API · Selenium Manager documentation

Install Selenium in an isolated Python environment

The current Selenium Python bindings require Python 3.10 or later. A virtual environment keeps this project’s dependencies separate from other Python projects. In a terminal, move to your project directory and run:

  1. Create the environment: python -m venv .venv.
  2. Activate it. On Windows PowerShell, run .venvScriptsActivate.ps1; on macOS or Linux, run source .venv/bin/activate.
  3. Install or upgrade Selenium: python -m pip install -U selenium.

If the python command on your system refers to a version older than 3.10, use the command for a Python 3.10+ interpreter instead. Check with python --version. Selenium’s official API documentation gives the version requirement and installation command: Selenium Python API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Start a local browser session and close it reliably

Save this as quickstart.py and run it with python quickstart.py inside the activated environment:

from selenium import webdriver


driver = webdriver.Chrome()
try:
    driver.get("https://example.com")
    print(driver.title)
finally:
    driver.quit()

webdriver.Chrome() starts a local Chrome session, get() navigates to the URL, and title reads the document title. The finally block ensures the session is closed even if navigation or later code raises an exception. Call quit() once the script is finished; leaving sessions open can leave browser processes running. The Selenium Python API documents the minimal local-session pattern. Selenium Python API

What happens with the browser driver?

Selenium Manager is included with current Selenium releases. When a suitable driver is not already provided, it can discover the installed browser version, resolve a compatible driver using vendor metadata, download it, and cache it. That is why manual driver downloads are not the default first step for a basic setup. In controlled environments, you can provide a browser and driver yourself. Manager’s behavior depends on its supported configuration and the platform; it does not mean every browser listed by the Python API can be downloaded by Manager. Selenium Manager documentation

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Find elements with locators that identify the right target

A locator describes how to find an element in the page. Choose one that fits the page’s structure and identifies the intended element unambiguously. IDs and names are useful when the page provides suitable values; CSS selectors and XPath are other options. No locator strategy is universally best.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
from selenium.webdriver.common.by import By

search_box = driver.find_element(By.NAME, "q")
search_box.send_keys("Selenium with Python")

matches = driver.find_elements(By.CSS_SELECTOR, "a.result-link")

find_element returns one matching element and raises an exception when it cannot find one. find_elements returns a list of matches; if none match, the list is empty. Replace the example attributes and selector with values that actually exist on the page you automate. Selenium’s locator reference shows the available strategies and Python examples: Locator strategies.

Make locators maintainable

  • Prefer an ID or name when it is present, meaningful, and uniquely identifies the target.
  • Use a CSS selector or XPath when the page structure calls for it, and keep the expression as specific as needed without tying it unnecessarily to fragile layout details.
  • When a locator matches more than one element, decide whether you need all matches or a narrower selector; do not assume the first match is the intended control.
  • If a locator stops working after a page change, inspect the current page structure and update the locator rather than adding arbitrary delays.

Wait for dynamic pages by condition, not by guesswork

A page can continue changing after navigation: JavaScript may add a control, populate results, or enable a button later. An explicit wait polls for a condition and continues when it becomes true or times out. The timeout is an upper bound for that wait, not a promise that a page will finish loading within that duration.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

wait = WebDriverWait(driver, 10)
search_box = wait.until(
    EC.visibility_of_element_located((By.NAME, "q"))
)
search_box.send_keys("Selenium with Python")

This waits up to 10 seconds for the element located by By.NAME, "q" to become visible. Use a condition that matches the next action: for example, visibility before typing or clickability before clicking. Selenium documents explicit waits and the available expected conditions in Waiting Strategies.

Avoid mixing implicit and explicit waits

Do not combine an implicit wait with explicit waits in the same script. Selenium warns that mixing them can produce unpredictable timeout durations. Prefer explicit waits for the specific page state your next action needs instead of relying on a global implicit delay. Waiting Strategies

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose local or remote execution

Local browser

A local session runs a browser on the machine executing your Python script. It is the simplest choice for learning, small scripts, and tests that can use a browser installed or managed in that environment. The Selenium Python API states: “For local Selenium scripts, the Java server is not needed.” Selenium Python API

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Remote browser with Grid

A remote session sends WebDriver commands to a browser running elsewhere through Selenium Grid and Remote WebDriver. This is a separate execution setup from launching a local browser; consult the official Selenium Grid documentation for configuration. Grid is not a prerequisite for first local exercises.

Browser and platform caveats

  • The Python API’s browser list and Selenium Manager’s browser-download support are not the same thing: Manager’s documented automatic downloads cover Chrome, Firefox, and Edge under supported configurations.
  • Using Selenium Manager to install Edge on Windows requires administrator permissions.
  • Linux-managed browsers can fail to launch if required system libraries are missing.
  • Browser and driver versions change over time. For unusual or controlled environments, check Selenium Manager’s current version controls and configuration guidance before customizing setup. Selenium Manager documentation

Use Selenium in tests without coupling setup to assertions

Selenium controls the browser; a test framework organizes test cases, setup, assertions, and cleanup. The Selenium Python API includes starter examples for both unittest and pytest. Use the framework your project or team already uses, and keep browser lifecycle management in the appropriate setup and teardown mechanism so sessions close when tests finish. Selenium Python API

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common setup and automation failures

Symptom Likely cause What to do
Python reports that Selenium cannot be imported. The package was installed into a different interpreter or environment than the one running the script. Activate the project virtual environment, then run python -m pip install -U selenium and execute the script using that same python.
Driver setup or browser startup fails. The browser is unavailable, the environment prevents Selenium Manager from resolving or downloading a driver, or the platform has an unmet requirement. Confirm the browser and Python environment; check Selenium Manager’s configuration and platform caveats. On Windows Edge, Manager requires administrator permissions; on Linux, check for missing system libraries. Selenium Manager documentation
find_element raises an element-not-found error. The locator does not match the current page, or the element has not appeared yet. Verify the locator against the current page structure and use an explicit wait for the relevant condition if the page renders the element asynchronously.
The script interacts too early or fails intermittently on a dynamic page. The next action runs before the required page state is ready. Wait explicitly for visibility, clickability, or another condition needed by that action. Avoid fixed sleeps as a substitute for a meaningful condition, and do not mix implicit and explicit waits. Waiting Strategies
A test ends but browser processes remain open. The session was not quit after the test or an exception interrupted normal cleanup. Put driver.quit() in a finally block for scripts, or use the test framework’s teardown/fixture cleanup for tests.

Or skip the browser setup

If the job is to capture a webpage rather than interact with it, ScreenshotNeo is a screenshot API and MCP server for developers. It accepts one GET request with a URL and returns a PNG, JPEG, WebP, or PDF. The following cURL example saves a WebP screenshot of https://example.com; see the ScreenshotNeo API documentation for request options and output formats.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Do I need to install Java to use Selenium with Python?

No. A Java server is unnecessary for local Selenium scripts; remote browser execution is a separate Grid/Remote WebDriver setup.

Which Python version does Selenium require?

The current Selenium Python bindings require Python 3.10 or later.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.