What Is Selenium and How to Set It Up?
Hi, I’m Nadeem — an ISTQB-certified QA engineer with over 7 years of hands-on experience in web and API testing. Over the years, I've worked with various automation tools, but Selenium remains one of the most reliable and widely adopted solutions. If you're wondering what Selenium is and how to set up Selenium, this guide covers everything you need to get started.
What Is Selenium?
Selenium is an open-source automation framework used for testing web applications across different browsers and platforms. It allows you to simulate user actions like clicking buttons, filling forms, and navigating pages — just like a real user would.
One of the key advantages of Selenium is that it supports multiple programming languages, including Java, Python, C#, JavaScript, and Ruby. It also integrates well with popular tools like TestNG, JUnit, Maven, and Jenkins, making it a core part of modern test automation pipelines.
Core Components of Selenium
- Selenium WebDriver: Automates browser interaction using a programming language.
- Selenium IDE: A browser plugin for record-and-playback style testing.
- Selenium Grid: Allows running tests on multiple machines and browsers in parallel.
Why Use Selenium?
- Supports all major browsers: Chrome, Firefox, Safari, Edge
- Cross-platform: Works on Windows, macOS, and Linux
- Language flexibility: Write tests in your preferred language
- Highly scalable: Great for distributed and parallel test execution
Selenium is trusted by startups and enterprise-level teams alike for both simple and complex testing needs.
How to Set Up Selenium on macOS
Setting up Selenium on a Mac is easy if you follow these steps. This example uses Java and Maven, but you can adapt it for Python, JavaScript, or C# depending on your stack.
1. Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. Install Java (OpenJDK 11+)
brew install openjdk
3. Install Maven
brew install maven
4. Set Up a New Maven Project
mvn archetype:generate -DgroupId=com.example.selenium -DartifactId=selenium-demo -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
5. Add Selenium Dependency
Edit pom.xml and include this inside <dependencies>:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.20.0</version>
</dependency>
6. Write Your First Selenium Test
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Main {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
System.out.println("Title: " + driver.getTitle());
driver.quit();
}
}
7. Download ChromeDriver
Make sure ChromeDriver matches your Chrome version:
brew install --cask chromedriver
Or manually download from chromedriver.chromium.org and add it to your system PATH.
8. Run the Test
mvn compile exec:java -Dexec.mainClass=Main
If everything is set up properly, Chrome will open, navigate to the URL, and print the page title.
Tips for Using Selenium Effectively
- Use WebDriverWait for handling dynamic elements
- Organize code using Page Object Model (POM)
- Integrate with CI tools like Jenkins or GitHub Actions
- Run in headless mode for faster execution in CI
Summary
This guide covered what Selenium is and how to set up Selenium on macOS using Java. Once installed, you can write and execute powerful automated browser tests for your web applications.
Selenium remains one of the best tools for cross-browser automation and continues to evolve with support for modern browsers and frameworks.
If you’d like help writing Selenium scripts or integrating them into your CI/CD pipeline, feel free to reach out.
Read more QA blogs at inadeem.me
Connect with me on LinkedIn