Recommended Free Tools
A data-driven Selenium framework runs the same browser workflow against multiple input and expected-result sets. Selenium WebDriver controls the browser, but it does not run tests or decide whether they pass: pair it with a language-compatible test runner, feed it isolated test data, and make explicit assertions. This guide shows complete starter examples in Python with pytest and Java with TestNG.
What data-driven Selenium testing means
Instead of duplicating a test for each input, define the workflow once and provide separate data sets. Each set should include both the input and the expected outcome, so the test can verify a meaningful result.
| Case | Input | Expected result |
|---|---|---|
| Valid credentials | Known test username and password | Account page appears |
| Invalid password | Known test username and incorrect password | Authentication error appears |
| Missing username | Blank username and a test password | Required-field validation appears |
These are illustrative cases, not claims about a particular website. Use an application and test accounts that your team is authorized to test.
Choose the test runner before designing the data source
WebDriver is the browser-automation layer. A test runner discovers and executes test functions or methods; its surrounding test framework provides assertions, lifecycle management, and reporting. Selenium’s components documentation explains that WebDriver does not perform comparisons or determine pass/fail: Selenium components.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- 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.
Choose the runner that fits your language, build workflow, CI environment, and team familiarity. The examples below use pytest for Python and TestNG for Java. Selenium also lists options such as unittest, JUnit, NUnit, MSTest, Jest, and Mocha, but its overview says the list is incomplete; it is not a ranking or exhaustive catalog: Selenium test frameworks.
| Choice | Documented data-driven mechanism | Good fit when |
|---|---|---|
| pytest | @pytest.mark.parametrize supplies multiple argument sets; fixtures can manage setup and cleanup. |
The project is Python-based and the team wants function-level tests and fixture-managed browser lifecycle. |
| TestNG | A method annotated @DataProvider returns values associated with a test method through dataProvider. |
The project is Java-based and its existing test workflow uses TestNG. |
Neither is a universal winner. Consider language fit, integration with the build tool and CI, reporting and failure diagnostics, lifecycle support, and how easily each test can remain isolated. See the pytest parametrization documentation and the TestNG documentation.
Install Selenium, a browser, and the runner
Install the language binding and test runner, and make a supported browser available. Selenium WebDriver communicates with the browser through browser-specific drivers and language bindings. Follow the current installation instructions for your chosen browser and Selenium version at Selenium WebDriver getting started; setup details can vary by browser, operating system, and tool version.
Rank #2
- 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.
Python with pytest
In a fresh Python environment, install the packages:
python -m pip install selenium pytest
Use a current supported Python release and follow Selenium’s setup documentation for the browser you intend to run. Do not assume a driver or browser is present just because the Python packages installed successfully.
Java with TestNG
Add Selenium and TestNG using the dependency and build-tool configuration appropriate for your project. Versions and dependency coordinates can change, so use the current setup guidance from Selenium and TestNG rather than copying a version pin that may be stale. Ensure the selected browser is installed and its driver setup is supported by your Selenium configuration.
Rank #3
- 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.
Build a small pytest implementation
This example keeps the data inline and uses a fixture to create one browser per test invocation. Replace the example URL, selectors, and cases with values for your authorized test application. The application is expected to expose a login form with the selectors shown and to display the expected messages in an element with #status.
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
CASES = [
pytest.param("valid-user", "correct-test-password", "Welcome", id="valid-login"),
pytest.param("valid-user", "wrong-test-password", "Invalid credentials", id="bad-password"),
pytest.param("", "some-test-password", "Username is required", id="missing-username"),
]
@pytest.fixture
def driver():
browser = webdriver.Chrome()
yield browser
browser.quit()
@pytest.mark.parametrize("username,password,expected", CASES)
def test_login_outcome(driver, username, password, expected):
driver.get("https://example.test/login")
driver.find_element(By.NAME, "username").send_keys(username)
driver.find_element(By.NAME, "password").send_keys(password)
driver.find_element(By.CSS_SELECTOR, "button[type='submit']").click()
status = driver.find_element(By.CSS_SELECTOR, "#status").text
assert expected in status
Save this as test_login.py and run it with:
python -m pytest -v test_login.py
pytest will report one test result for each parameter set. The fixture is function-scoped by default, so each case gets a fresh browser and the yielded teardown calls quit() after the test, including when an assertion fails.
Build the equivalent TestNG implementation
The following Java example uses a TestNG data provider to feed the same three kinds of cases to one test method. Add the imports and class to your Java test source tree, and adapt the URL, locators, and expected page behavior to your application.
Rank #4
- 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
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class LoginDataDrivenTest {
@DataProvider(name = "loginCases")
public Object[][] loginCases() {
return new Object[][] {
{"valid-user", "correct-test-password", "Welcome"},
{"valid-user", "wrong-test-password", "Invalid credentials"},
{"", "some-test-password", "Username is required"}
};
}
@Test(dataProvider = "loginCases")
public void loginOutcome(String username, String password, String expected) {
WebDriver driver = new ChromeDriver();
try {
driver.get("https://example.test/login");
driver.findElement(By.name("username")).sendKeys(username);
driver.findElement(By.name("password")).sendKeys(password);
driver.findElement(By.cssSelector("button[type='submit']")).click();
String status = driver.findElement(By.cssSelector("#status")).getText();
Assert.assertTrue(status.contains(expected),
"Expected status to contain: " + expected + "; actual: " + status);
} finally {
driver.quit();
}
}
}
The finally block closes the session even if navigation, element lookup, or assertion fails. Configure the test class and dependencies in your project’s existing TestNG and build-tool workflow; consult the current TestNG documentation for execution configuration.
Decide where test data should live
Keep a small, stable set inline
Inline parameters make a starter test easy to read, review, and debug. Use them when the data set is small, fixed, and meaningful as part of the test itself.
Move growing or separately maintained cases to a file
CSV or JSON can make sense when test cases grow, need review by people who do not edit test logic, or are reused across test modules. Validate required columns, types, and expected values before launching a browser; a malformed row should fail clearly rather than become a confusing browser error. Keep fixture files deterministic and checked into version control only when their contents are safe to commit.
Best Value
- 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.
Use a database only for a real operational need
A database may be appropriate when data is large, generated dynamically, or managed by an existing test-data process. It adds connection, cleanup, and environment dependencies, so it is usually unnecessary for a few representative cases. Never place passwords, tokens, or production personal data in committed fixtures; obtain secrets through the team’s approved secret-management process.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Keep tests isolated and diagnosable
- Use fresh state. Selenium advises against sharing test data and recommends a new WebDriver instance per test. That reduces coupling and makes parallel execution easier to reason about: Avoid sharing state.
- Make each case independent. A test should not depend on another case having created a user, changed a setting, or left a browser open. Arrange its own preconditions and clean up data it creates.
- Keep the browser workflow discrete. Setup data, perform a focused sequence of actions, and evaluate the outcome. Browser tests need browser infrastructure and can be comparatively expensive, so avoid turning one parameterized method into an oversized end-to-end scenario: Selenium test practices.
- Name cases. Use pytest parameter IDs or descriptive TestNG data so a failure identifies the input scenario without printing sensitive values.
- Capture useful failure context. Report the case identifier, assertion message, and relevant non-sensitive state. Avoid logging credentials, cookies, authorization headers, or other secrets.
Scale only after the tests are reliable
First run the cases serially and confirm that each passes or fails independently and that every browser is closed. Then consider CI execution or parallelization. Parallel tests need separate browser sessions and data that cannot collide—for example, separate test accounts or uniquely generated records with reliable cleanup. Selenium’s guidance connects avoiding shared state and creating a new WebDriver instance per test with isolation and simpler parallelization: Selenium isolation guidance.
Remote WebDriver or a Selenium Grid can move browser execution to remote infrastructure, but it does not remove the need for isolated data, clear assertions, or actionable logs. Add remote execution only when the project has a concrete browser, platform, or capacity requirement and can support that infrastructure.
Common failures and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| Browser does not start | Browser, driver, or Selenium setup is incomplete or incompatible. | Confirm the browser is installed, follow current Selenium setup guidance for that browser, and inspect the startup exception before changing versions. |
| Element lookup fails | The example locator does not match the page, the page has not reached the relevant state, or the application markup differs. | Verify the URL and locator against the test environment. For asynchronously rendered content, wait for a meaningful condition instead of assuming the element is immediately available. |
| Every parameter set fails identically | The shared workflow or environment may be wrong, rather than every data row. | Run one case, inspect navigation and form behavior, then verify the selector and expected message before expanding the data set. |
| Cases pass alone but fail in a suite or parallel run | Tests may share accounts, browser state, or mutable server-side records. | Give each invocation independent browser and test data, and remove order dependencies. |
| Browser remains running after failure | Teardown was not guaranteed. | Use fixture teardown in pytest or a Java finally block as shown, and ensure cleanup executes around the whole browser interaction. |
| A test fails on an unclear assertion | The expected outcome is vague or the assertion omits actual context. | Assert a specific user-visible outcome and include a safe, descriptive failure message. |
Or skip the browser setup
If your immediate goal is a page image or PDF rather than interactive test assertions, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; its clean-shot steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture, with each step configurable. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents.
For a quick API call, create an API key and replace the URL with the page you want to capture:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. This one-call capture is not a substitute for Selenium when you need to interact with a workflow, run assertions, or verify behavior across test inputs.
ScreenshotNeo includes 1,000 shots per month free without a card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.
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.
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 →

