How to install Selenium in Intellij?

On This Page What is IntelliJ?Pr

May 15, 2026 · 8 min read · Tool Comparison

How to establish Selenium in Intellij?

is a popular instrument for automating web applications, and IntelliJ IDEA is one of the best IDEs for Java development.

Overview

Steps to Install Selenium in IntelliJ:

  1. Install IntelliJ IDEA(Community or Ultimate Edition)
  2. Create a newJava or Maven project
  3. Add Selenium WebDriver dependencies(via Maven or manually)
  4. Configure yourprojection construction and build path
  5. Write yourfirst Selenium trial hand
  6. Run and validate the script usingJUnit or TestNG

This guide render a comprehensive walkthrough of installation and configuring Selenium within IntelliJ, enable efficient test development and execution.

What is IntelliJ?

IntelliJ IDEA is a feature-rich for Java development. It offers a suite of coding, debugging, and testing tools, streamlining the. Its compatibility with Selenium makes it a top choice for mechanisation testing.

Pre-requisites to Install IntelliJ with Selenium Webdriver

Before setting up Selenium, ensure the following requirements are met:

Step 1. Java Installation and Setup (JDK)

Java -version Javac -version
  • Set the JAVA_HOMEenvironment variable.
  • Search for “Environment Variables” in Local, and Click onEdit Environment Variable for your account.
  • Under System Variables, click onNEW button.
  • In the Varying name field, enter asJAVA_HOMEand in the Variable value field, browse the directory where the latest JDK is installed.
  • Click OKto save the changes.

Step 2. IntelliJ IDEA Installation (Community/Ultimate)

Download and install IntelliJ IDEA, either the Community or Ultimate edition.

Step 3. JDK Configuration in IntelliJ

  • Open IntelliJ and go toFile - & gt; Project Structure - & gt; Project - & gt; SDKs.
  • Select the installed JDK to ensure compatibility.

Read More:

How to Download & amp; Install IntelliJ?

To commence, the IntelliJ IDEA IDE must be produce and installed. While this process is simple, it requires adherence to specific stairs for a successful apparatus.

  • Visit the officialJetBrainswebsite to download the IntelliJ IDEA installer.
  • Select the appropriate operating scheme and edition (Community or Ultimate).
  • Once the download is successful, run the.exe (Windows)file and start the installation setup. In the following screen, click onNEXT.
  • Choose the installation directory by tick onBrowse.
  • Check the box and configure any desired options, so click onNEXT.
  • Complete the installation process by chatter onFINISH button.

Read More:

Setting up a new Selenium Project in IntelliJ

To begin writing Selenium trial within IntelliJ, a project tailored for this purpose must be created. The undermentioned steps will steer you through the necessary configuration.

1. Exposed IntelliJ. On the welcome screen, pawl onNew Project, or else postdate the path below to create the project.

Path: File - & gt; New - & gt; Project

2. Enter a project name and modify its location if necessary by clicking on the folder icon.

3. Choose Javaas the project language.

4. Select the installed JDK version from the drop-down.

5. Ensure the JDK is configured inProject Structure.

6. Click Create.

Read More:

Installing Selenium WebDriver

The WebDriver component is the core functionality of Selenium testing. The followers will describe the various ways to comprise the Selenium WebDriver into the IntelliJ environment.

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

Step 1. Adding Selenium JARs Manually

  • Download Selenium JAR files fromSeleniumofficial website.
  • In IntelliJ, navigate toProject Structure & gt; Libraries & gt; Add JARs.

Step 2. Using Maven to Add Selenium Dependencies:

  • Add the undermentioned dependencies to thepom.xml file.
& lt; dependencies & gt; & lt;! -- Selenium Java Dependency -- & gt; & lt; dependency & gt; & lt; groupId & gt; org.seleniumhq.selenium & lt; /groupId & gt; & lt; artifactId & gt; selenium-java & lt; /artifactId & gt; & lt; adaptation & gt; 4.20.0 & lt; /version & gt; & lt; /dependency & gt; & lt; /dependencies & gt;
  • IntelliJ will automatically download the mandatory dependencies.

Step 3. Using Gradle to Add Selenium Dependencies:

  • Add the selenium dependency to thebuild.gradle file.
dependencies {// Add Selenium dependency execution 'org.seleniumhq.selenium: selenium-java:4.21.0 ' // Use late adaptation}
  • Gradle will download and add the dependency.

Downloading WebDriver Executables

Each web browser need its corresponding WebDriver executable to facilitate. The following outlines the download and frame-up procedure for commonly used browsers.

ChromeDriver (For)

  1. Download thechromedriver.exe from the ChromeDriver website.
  2. Set the Path to the ChromeDriver executable on your Windows scheme.
  3. To Set up the driver in your script:
System.setProperty (`` webdriver.chrome.driver '', `` C: \\path\\chromedriver.exe '');

Note:

On Windows: & # 8220; C: \\Path\\to\\ chromedriver.exe & # 8221;

On macOS/Linux: & # 8220; /path/to/ chromedriver & # 8221;

GeckoDriver (For)

  1. Download thegeckodriver from MozillaGitHub depositary.
  2. Set the Path to the GeckoDriver viable on your Windows system.
  3. To set up the driver in your handwriting:
System.setProperty (`` webdriver.gecko.driver '', `` C: \\path\\to\\geckodriver.exe '');

EdgeDriver (For Microsoft Edge)

  1. Download themsedgedriver.exe from MicrosoftWebDriver website.
  2. Place the executable in a directory include in the system ’ s PATH.

SafariDriver (For on macOS)

SafariDriver is build into, and it can be enable in different ways.

1. Path to enable SafariDriver

  • Navigate toSafari& gt; Preferences & # 8211; & gt; Advanced tab. Check theShow Developmenu in menu bar.
  • Click Developmenu and selectAllow Remote Automation.

2. Enable SafariDriver via Terminal

Open the Terminal and run the next command:

safaridriver –enable

Talk to an Expert

Writing and Running a Sample Selenium Test

With the surroundings configured, control its functionality through a simple test is essential. The following sketch the stairs to make and run a sampling Selenium script.

Writing a Canonical Selenium Test:

Here is a codification to write a canonic Selenium test.

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class SeleniumTest {public static emptiness main (String [] args) {// Set the path to the ChromeDriver executable System.setProperty (`` webdriver.chrome.driver '', `` path/to/chromedriver.exe ''); // Create a new case of the Chrome driver WebDriver driver = new ChromeDriver (); // Navigate to Google driver.get (`` https: //www.google.com ''); // Print the page title System.out.println (`` Page Title: `` + driver.getTitle ()); driver.quit (); // Close the browser}}

Running the Test in IntelliJ

  1. Right-click on the test grade or method and selectRunor Click onlight-green triangle run iconat the top right corner of IntelliJ, or pressShift + F10to run the test.
  2. IntelliJ will execute the test and exhibit the results in the console.
  3. If there are any mistake or exception, they will likewise be exhibit hither, which will be helpful in diagnosing subject.

Explanation

  1. The program sets the path to theChromeDriverexecutable.
  2. Make sure to supercede & # 8220; path/to/chromedriver.exe & # 8221; with thereal pathon your scheme.
  3. A new instance of the Chrome browser is created using thenew ChromeDriver ().
  4. The browser navigates tohttps: //www.google.com.
  5. The program retrieve the title of the current page usingdriver.getTitle ().
  6. The title is printed to the console bySystem.out.println.
  7. The browser is closed withdriver.quit ().

Output

Configuring IntelliJ for Better Selenium Development

Specific configurations can be utilise to optimise the Selenium evolution workflow within IntelliJ. These adjustments aim to streamline the cryptography and debugging operation.

Enable Auto-import for Dependencies

  • Configure IntelliJ to mechanically spell necessary classes.
  • To enable Auto-import, navigate toPreferences & gt; Build, Execution, Deployment & gt; Maven.

Setting Up Logs and Debugging

  • Configure log frameworks for Selenium and the application.
  • Utilize IntelliJ ’ sdebugging toolsto step through the selenium codification.

Read More:

How to integrate Selenium with a Test Framework in IntelliJ?

For engineer and maintainable tests, integrating Selenium with a test fabric is crucial. This section details how to configure IntelliJ to work seamlessly with popular frameworks.

JUnit Integration

  • IntelliJ provides built-in support for JUnit.
  • To use in the Maven project, Add the following addiction in thepom.xml file:
& lt; dependency & gt; & lt; groupId & gt; junit & lt; /groupId & gt; & lt; artifactId & gt; junit & lt; /artifactId & gt; & lt; variant & gt; 4.13.2 & lt; /version & gt; & lt;! -- Use the up-to-the-minute version -- & gt; & lt; scope & gt; test & lt; /scope & gt; & lt; /dependency & gt;
  • Use the @Testnote to write and accomplish test cases.

TestNG Integration

  • Install the TestNG plugin for IntelliJ. Add the TestNG dependency to the labor (Inpom.xml file)

Read More:

& lt; dependency & gt; & lt; groupId & gt; org.testng & lt; /groupId & gt; & lt; artifactId & gt; testng & lt; /artifactId & gt; & lt; version & gt; 7.7.0 & lt; /version & gt; & lt;! -- Use the latest version -- & gt; & lt; scope & gt; test & lt; /scope & gt; & lt; /dependency & gt;
  • Use @Testto define and execute TestNG test example.

Why use BrowserStack for Selenium Tests?

supply a cloud-based platform for pass Selenium tests across a huge reach of real browsers and operating systems. This eliminates the need to maintain local try infrastructure, ascertain thorough test reporting and faster feedback rhythm.

Using BrowserStack Automate, you can,

  • Test across 3500+ existent browsers and devices
  • Ensure cross without maintaining test infrastructure
  • Run Selenium tests on the BrowserStack cloud for faster, scalable automation
  • Integrate seamlessly with tools like, GitHub, and more
  • Accelerate debug with video recordings, logarithm, and screenshots

Conclusion

Setting up Selenium in IntelliJ is a aboveboard process that empowers developers to create and execute machine-controlled web examination expeditiously. It is peculiarly helpful when using Maven or Gradle for dependency management.

By following the step outlined in this guidebook, one can establish a robust testing surround. enable to run Selenium tests on a wide mixture of real devices, OS, and browsers without the motivation for physical infrastructure.

Tags
25,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free