---Advertisement---

How to Set Up IntelliJ IDEA with Selenium WebDriver: Step-by-Step Guide with Example Great 2025

By Manisha

Updated On:

---Advertisement---
How to Set Up IntelliJ IDEA with Selenium

๐Ÿ“ŒHow to Set Up IntelliJ IDEA with Selenium WebDriver

How to Set Up IntelliJ IDEA with Selenium: IntelliJ IDEA is one of the most powerful Java IDEs developed by JetBrains. It supports a variety of languages and tools and is ideal for Selenium-based test automation using Java.

This guide will help you install IntelliJ, configure Selenium libraries, and run your first Selenium test using IntelliJ.


๐Ÿ“Œ Table of Contents

  1. What is IntelliJ IDEA?
  2. Pre-requisites for Selenium Setup in IntelliJ
  3. How to Download and Install IntelliJ
  4. Configure IntelliJ for Selenium WebDriver
  5. Create a Selenium Example Project in IntelliJ
  6. Advantages of Using IntelliJ
  7. Summary

How to Set Up IntelliJ IDEA with Selenium: IntelliJ IDEA is a full-featured Java IDE used for developing software applications. Developed by JetBrains, it offers both a free Community Edition and a paid Ultimate Edition. IntelliJ stands out due to:

  • Intelligent code completion
  • Code navigation
  • Powerful refactoring tools
  • Built-in support for Gradle, Maven, Git, and more

How to Set Up IntelliJ IDEA with Selenium: Before starting, ensure the following are available:

  • โœ… IntelliJ IDEA (Community or Ultimate)
  • โœ… Java Development Kit (JDK) installed
  • โœ… Web browser (Firefox recommended for this example)
  • โœ… Selenium Java .jar files
    Download from: https://www.selenium.dev/downloads/
    Extract .jar files from the ZIP to a local directory.

Step 1:

Visit the
Select Community Edition (Free) or Ultimate Edition

Step 2:

Download the setup file and run the installer.

Step 3 to 8:

Follow the wizard steps:

  • Choose install location
  • Select 32-bit launcher (optional)
  • Select UI language
  • Click Install and then Finish

Step 9-10:

  • Choose whether to import settings from a previous version.
  • Accept the JetBrains Privacy Policy.

Step 11-13:

  • Set up initial plugins (optional).
  • Choose Create New Project on the welcome screen.
  • Create a project with name, e.g., Selenium_Guru99.

Step 1:

Go to File โ†’ New โ†’ Project. Select Java and click Next.

Step 2:

Name the project (e.g., Selenium_Guru99) โ†’ Click Finish.

Step 3: Add Selenium .jar Files

Go to File โ†’ Project Structure โ†’ Modules โ†’ Dependencies
Click the โž• button โ†’ JARs or Directories โ†’ Select all .jar files from the Selenium folder and /lib subfolder.

Step 4:

Right-click the /src directory โ†’ New โ†’ Java Class
Create your test class (e.g., LoginTest)


Test Scenario:

How to Set Up IntelliJ IDEA with Selenium: We will automate the following:

  • Launch a browser
  • Navigate to URL
  • Enter an invalid email
  • Click submit
  • Validate error message

Example Java Code:

java

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.By;

public class LoginTest {

    public static void main(String[] args) {

        System.setProperty(“webdriver.gecko.driver”, “path_to_geckodriver”);

        WebDriver driver = new FirefoxDriver();

        driver.get(“https://example.com/login”);

        driver.findElement(By.id(“email”)).sendKeys(“abc.gmail.com”);

        driver.findElement(By.id(“submit”)).click();

        String errorMsg = driver.findElement(By.id(“error”)).getText();

        System.out.println(“Error Message: ” + errorMsg);

        driver.quit();

    }

}

Output:

  • Firefox browser opens
  • Invalid email is entered
  • Error message displays: “Email ID is not valid.”

๐Ÿ“Œ Advantages of Using IntelliJ for Selenium

  • How to Set Up IntelliJ IDEA with Selenium: Auto-generates getter/setter methods
  • Wraps code in try-catch or if-else blocks with simple shortcuts
  • Built-in support for Gradle, Maven, Grunt, SBT
  • Access databases like MySQL, Oracle, PostgreSQL from the IDE
  • Supports multiple languages: Java, JavaScript, Clojure, Kotlin
  • Compatible with Windows, macOS, Linux

๐Ÿ“Œ Summary

  • How to Set Up IntelliJ IDEA with Selenium: IntelliJ IDEA is a powerful and user-friendly IDE for Java development.
  • Easily integrates with Selenium WebDriver for automation testing.
  • Offers smart features like code refactoring, navigation, plugin support, and cross-platform compatibility.
  • With proper configuration and Selenium libraries, you can run and manage robust automation test scripts efficiently.

JetBrains IntelliJ Official Website

Selenium Python Tutorial

Leave a Comment

Index