Selenium lets Python tests control a real browser through WebDriver; Nose can run a Selenium test, but it is a legacy runner rather than the framework used in Selenium’s current Python examples. If you maintain a Nose suite, use the setup below as a starting point and verify its fixtures, plugins, and pinned versions. For a new suite, Selenium documents unittest and pytest patterns.
What Selenium and Nose each do
As Selenium’s official Python API documentation puts it, “The selenium package is used to automate web browser interaction from Python.” WebDriver opens a browser, navigates pages, and interacts with page elements. A test runner discovers and executes tests and reports their assertions. Nose supplies that runner role; it does not replace WebDriver.
As an Amazon Associate I earn from qualifying purchases.
Nose’s 1.3.7 usage documentation describes running tests with the nosetests command. That documents how to invoke Nose, not whether it is actively maintained or a recommended choice for a new project.
Check versions and browser prerequisites
Selenium’s Python API documentation lists Python 3.10 or later for its documented release and names Chrome, Edge, Firefox, Safari, WebKitGTK, and WPEWebKit among supported browsers. Selenium’s downloads page reports Python client 4.49.0 as stable, released September 9, 2026. These details are version-sensitive: check the Selenium release and browser/platform support that apply to your environment before installing.
#1 Best Overall
- Use a Python environment compatible with the Selenium version you intend to install.
- Install and update a supported browser on the machine that will run the test.
- Modern Selenium can use Selenium Manager to handle driver setup when a WebDriver is instantiated. Older instructions to manually download a driver and add it to
PATHmay not apply, but browser and platform availability still matters. - A local browser test does not require Selenium Server. Remote WebDriver execution requires a Selenium Grid.
Install Selenium and Nose in an isolated environment
Create and activate a virtual environment using the method appropriate for your operating system, then install the packages:
python -m venv .venv
# Activate .venv using the command for your shell and operating system
python -m pip install selenium nose
To keep a project reproducible, pin the versions your team has validated in its dependency file and run tests in that environment. Installing the packages alone does not guarantee that a browser is installed or available to the process.
Write a Selenium test that Nose can run
This example uses unittest.TestCase, a test style Selenium documents and Nose can discover. Register driver.quit immediately after creating the browser so the session is closed even if navigation or an assertion fails.
Rank #2
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By
class ExamplePageTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.addCleanup(self.driver.quit)
def test_page_has_title(self):
self.driver.get("https://example.com")
heading = self.driver.find_element(By.TAG_NAME, "h1")
self.assertTrue(heading.text)
if __name__ == "__main__":
unittest.main()
Save it as test_example.py. The example opens Chrome, visits the page, finds its first h1, and checks that the heading has text. Nose’s usage documentation describes invoking the suite with:
nosetests
Run that command from the project directory in the same environment where Selenium, Nose, and the browser are available. The script’s unittest.main() entry point also allows direct execution with Python, independently of Nose.
Manage the browser session reliably
A WebDriver session is a separate browser process or remote session, so closing it is part of test cleanup. The example registers cleanup immediately after browser creation; if setup or an assertion later fails, unittest still calls the registered cleanup. For a Selenium-documented pytest pattern, use a fixture with teardown after yield:
Rank #3
import pytest
from selenium import webdriver
@pytest.fixture
def driver():
browser = webdriver.Chrome()
yield browser
browser.quit()
def test_page_title(driver):
driver.get("https://example.com")
assert driver.title
The fixture creates one browser for the test and quits it afterward. Choose test isolation deliberately: sharing a browser can save startup time but can also let cookies, tabs, or page state leak between tests. Creating a fresh browser per test gives cleaner isolation at the cost of startup overhead.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Is Nose compatible with current Selenium tests?
Selenium’s current Python API examples use unittest and pytest; its organizing-and-executing guidance lists those runners for Python. Nose appears in older usage documentation, so an existing Nose suite may still run, but that is not the same as a current recommendation.
There is an additional caveat if the suite uses pytest’s Nose compatibility rather than Nose itself: the pytest 8.0 documentation describes only basic support for Nose-written tests and marks Nose compatibility deprecated, with removal likely in pytest 8.x. It lists Nose-style setup/teardown hooks and SkipTest among supported idioms. It also says that unittest-style setUp, tearDown, setUpClass, and tearDownClass methods on plain classes are not recognized as they are on unittest.TestCase subclasses. These notes apply to that versioned pytest documentation; check the exact pytest version and test idioms in your project rather than assuming they apply universally.
Rank #4
Keep an existing Nose suite
- Record the pinned Python, Selenium, Nose, and—if present—pytest versions.
- Inventory fixtures, setup and teardown conventions, Nose plugins, and command-line options the suite relies on.
- Run the existing suite in its pinned environment before changing dependencies. Confirm which tests are discovered and whether browser sessions close on failures.
- If you use pytest’s Nose compatibility, compare every Nose idiom in the suite with the compatibility notes for your exact pytest version.
- Test any migration in a controlled branch, checking discovery, setup and teardown, skips, plugins, and browser cleanup before changing the team’s normal test command.
Starting a new suite
Without an existing Nose constraint, follow one of Selenium’s current documented runner patterns: unittest for the standard-library test framework or pytest for a fixture-based style. The sources do not establish one runner as universally best; fit depends on the repository, its dependencies, and its test conventions.
Local browsers versus Selenium Grid
The code above starts a local Chrome session. If tests must run against a remote browser, use a Selenium Grid and configure a remote WebDriver connection for that Grid; local driver management and remote session configuration are different concerns. Choose the runner based on how tests are organized, and choose local versus Grid execution based on where the browser must run. The available documentation here establishes that remote WebDriver use requires Grid, but does not specify a Grid deployment recipe or endpoint.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshooting common failures
nosetestsis not found: Confirm Nose was installed in the active virtual environment and invoke the command from that environment. The shell may be using a different Python installation.- No tests are discovered: Check that the file and test names follow the discovery conventions expected by the installed runner, and run the command from the project directory. Nose’s usage documentation covers its command, but discovery behavior can depend on configuration and version.
- WebDriver cannot start: Confirm the selected browser is installed and available to the account running the test, and verify browser/platform support for the Selenium version in use. Modern Selenium uses Selenium Manager for driver setup, but it cannot make an unavailable browser appear.
- The test passes locally but fails in CI: Compare Python, Selenium, browser, and operating-system versions, plus whether CI runs a local browser or targets a Grid. Ensure the runner process can access the browser and any required remote endpoint.
- Tests hang or leave browsers running: Ensure each created driver has cleanup registered immediately or is quit in fixture teardown. Also inspect navigation or page waits if the browser remains active; do not rely on the process exiting to close sessions cleanly.
- Pytest fails to recognize a Nose-style test: Check the exact pytest version and whether the class or hook uses an idiom listed as unsupported by its Nose compatibility documentation. In particular, plain classes do not receive unittest-style setup/teardown handling under the documented compatibility behavior.
Or skip the browser setup
If the task is to capture a website image or PDF rather than exercise browser behavior and assert test outcomes, ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. Its cleanup options remove cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Here is a Python request:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
open("shot.webp", "wb").write(r.content)
See the ScreenshotNeo documentation for request options. ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. It is a screenshot service, not a substitute for Selenium tests that need to interact with a page and assert application behavior. Sign up for ScreenshotNeo’s free plan.
Best Value
Frequently Asked Questions
Can I use Nose without pytest?
Yes. Nose and pytest are separate runners; pytest’s Nose compatibility warning matters only if you are using pytest to run Nose-style tests.
Does a Selenium screenshot prove a page works?
No. A screenshot records rendered output; interaction tests and assertions are needed to verify behavior.
Quick Recap
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.




