---
title: How to launch the browsers ? 
description: "**How to launch the browsers ? ** 1. **How to launch a chrome browser? ** ***Selenium 3 (Legacy Approach) using**Manual ChromeDriver Setup* ```javascript import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class Selenium3ChromeLaunch {     public static void main(String[] args) {         // 1. Set system property…"
url: "https://vinothqaacademy.com/docs/how-to-launch-the-browsers/"
updated: "2025-09-26"
category: Selenium Automation Testing
tags:
  - Selenium Automation Testing
---

# How to launch the browsers ? 

**How to launch the browsers ? **

1. **How to launch a chrome browser? **

***Selenium 3 (Legacy Approach) using**Manual ChromeDriver Setup*

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class Selenium3ChromeLaunch {

    public static void main(String[] args) {

        // 1. Set system property for ChromeDriver

        System.setProperty("webdriver.chrome.driver", "C:\path\to\chromedriver.exe");

        // 2. Initialize ChromeDriver

        WebDriver driver = new ChromeDriver();

        // 3. Navigate to URL

        driver.get("https://www.google.com");

        // 4. Get page title

        System.out.println("Page Title: " + driver.getTitle());

        // 5. Quit driver

        driver.quit();

    }

}
```

**Key Characteristics of Selenium 3:**

- Requires manual ChromeDriver path setup
- No built-in driver management
- Uses JSON Wire Protocol (older protocol)

***Selenium 4 (Modern Approach) using Selenium Manager ** (Built-in from Selenium 4.6+)*

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

public class Selenium4AutoDriver {

    public static void main(String[] args) {

        // No setup needed - Selenium Manager handles it automatically

        WebDriver driver = new ChromeDriver();

        driver.get("https://www.google.com");

        System.out.println("Page Title: " + driver.getTitle());

        driver.quit();

    }

}
```

**Key Improvements in Selenium 4:**

- ***Automatic Driver Management**:*

1. Selenium Manager (built-in)

2. No need for System.setProperty()

**2. How to launch a mozilla firefox browser? **

*Using Selenium 4 *

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class LaunchFirefox {

    public static void main(String[] args) {

        WebDriver driver = new FirefoxDriver();

        driver.get("https://www.google.com");

        System.out.println("Title: " + driver.getTitle());

        driver.quit();
```

*Using Selenium 3 *

```javascript

                System.setProperty("webdriver.gecko.driver", "C:\path\to\geckodriver.exe");

WebDriver driver = new FirefoxDriver();
```

**3. How to launch a microsoft edge browser? **

*Using Selenium 4*

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.edge.EdgeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class LaunchEdge {

    public static void main(String[] args) {

        WebDriverManager.edgedriver().setup();

        WebDriver driver = new EdgeDriver();

        driver.get("https://www.google.com");

        System.out.println("Title: " + driver.getTitle());

        driver.quit();

    }

}
```

*Using Selenium 3*

```javascript

                System.setProperty("webdriver.edge.driver", "C:\path\to\msedgedriver.exe");

WebDriver driver = new EdgeDriver();
```

**4. How to launch a safari browser? (macOS Only)**

***No WebDriverManager Needed (Built-in)***

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.safari.SafariDriver;

public class LaunchSafari {

    public static void main(String[] args) {

        // Enable Safari Driver in Terminal first:

        // `safaridriver --enable`

        WebDriver driver = new SafariDriver();

        driver.get("https://www.google.com");

        System.out.println("Title: " + driver.getTitle());

        driver.quit();

    }

}
```

**5. How to launch a headless browser? **

***Chrome Headless***

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.chrome.ChromeOptions;

import io.github.bonigarcia.wdm.WebDriverManager;

public class ChromeHeadless {

    public static void main(String[] args) {

        ChromeOptions options = new ChromeOptions();

        options.addArguments("--headless=new"); // New headless mode in Selenium 4+

        WebDriver driver = new ChromeDriver(options);

        driver.get("https://www.google.com");

        System.out.println("Title: " + driver.getTitle());

        driver.quit();

    }

}
```

***Firefox Headless***

```javascript

                import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.openqa.selenium.firefox.FirefoxOptions;

import io.github.bonigarcia.wdm.WebDriverManager;

public class FirefoxHeadless {

    public static void main(String[] args) {

        FirefoxOptions options = new FirefoxOptions();

        options.addArguments("--headless");

        WebDriver driver = new FirefoxDriver(options);

        driver.get("https://www.google.com");

        System.out.println("Title: " + driver.getTitle());

        driver.quit();

    }

}
```
