Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

To install Selenium and set up a testing environment, install a language runtime (such as the JDK for Java or Python 3), add the Selenium client library through a build tool like Maven or pip, choose an IDE, and let Selenium Manager handle browser drivers automatically. You are then ready to write and run your first test. Modern Selenium removes most of the manual driver setup that older guides describe.
This guide walks through the full setup for both Java and Python, shows a working first script, explains the mistakes beginners hit most often, and covers how to skip local driver management entirely by running on a cloud grid. If you want a broader reference afterwards, the Selenium WebDriver tutorial and the WebDriver learning hub go deeper.
Regardless of language, a Selenium environment needs a few basic pieces in place:
For Java, install the latest JDK from an OpenJDK or Oracle distribution and set the JAVA_HOME environment variable. Then create a Maven project and add the Selenium dependency to your pom.xml so the build tool manages the library and its versions for you:
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.25.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>Run mvn clean install to download the dependencies. With Selenium 4.6 and later, you do not need to download ChromeDriver or GeckoDriver manually, Selenium Manager resolves the correct driver at runtime.
Python setup is even shorter. Install Python 3, then use pip to add Selenium. Using a virtual environment keeps dependencies isolated per project:
# Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install the Selenium package
pip install selenium
# Confirm the installed version
python -c "import selenium; print(selenium.__version__)"That single pip command installs Selenium and its dependencies. As with Java, driver management is automatic in modern versions.
With the library installed, a minimal test confirms the environment works end to end. This Java example opens a page, reads its title, and closes the browser:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class FirstTest {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
System.out.println("Page title: " + driver.getTitle());
driver.quit();
}
}If the browser launches and prints the title, your installation is correct. From here you can add a framework such as TestNG or pytest to structure and report on your tests. For the next step, see how to write and run test scripts in Selenium.
Local setup is fine for writing tests, but it limits you to the browsers on your own machine and adds driver maintenance. By pointing your WebDriver at a cloud grid, you skip local drivers entirely and gain far broader coverage. TestMu AI lets you run Selenium tests across 3000+ real browsers and devices without installing any of them locally, so you can validate Chrome, Safari, Edge, and mobile combinations from one script. It is the fastest way to move from a working local setup to reliable cross browser testing and full automation testing at scale.
Setting up Selenium is far simpler than older guides suggest: install a runtime, pull the client library with Maven or pip, pick an IDE, and let Selenium Manager handle drivers. A quick first script confirms everything works. When you are ready to test beyond your local machine, a real-device cloud removes driver upkeep and unlocks thousands of browser and OS combinations, turning a basic install into a production-grade testing environment.
Not anymore in most cases. Selenium 4.6 and later include Selenium Manager, which automatically downloads and configures the correct driver for your installed browser. You only need to manage drivers manually for older Selenium versions or unusual setups.
Selenium supports Java, Python, C#, JavaScript, and Ruby. Java and Python are the most common: Java pairs well with Maven and TestNG for large teams, while Python is quicker to start with thanks to pip and concise syntax. Choose the language your team already knows.
Install Python 3, then run pip install selenium in your terminal. This pulls the latest Selenium package and its dependencies. With Selenium Manager handling drivers, you can immediately instantiate a WebDriver and write your first test without extra configuration.
Selenium Manager automatically resolves, downloads, and caches the browser driver that matches your browser version at runtime. Manual setup requires you to download the driver, match its version to the browser, and add it to the system PATH, which is more error-prone.
Yes. A cloud grid like TestMu AI (Formerly LambdaTest) hosts thousands of real browser and OS combinations, so you point your WebDriver at the remote endpoint instead of a local browser. This removes local driver and browser maintenance and lets you test environments you do not have on your machine.
A SessionNotCreatedException usually means the driver and browser versions are incompatible. Update both to compatible versions, or upgrade to Selenium 4.6+ so Selenium Manager resolves the correct driver automatically. Also confirm the browser is actually installed on the machine running the test.
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.

TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance