Search
  • +44-7459919437 (UK- WhatsApp & Direct Call) | +91-6383544892 (India - WhatsApp Only) | Email Id : vinothrwins@gmail.com
Vinoth Tech Solutions
  • Home
  • Selenium Java Online Training
  • Self Paced Video Course
    • Selenium Course Curriculum
    • Cypress Course Curriculum
    • Playwright Course Curriculum
  • Tutorials
  • Demo Sites
    • E-Commerce Demo Application
    • Practice Automation
      • Demo Page Healthcare
      • Registration Form
      • Transaction Details
      • DropDown
      • Mouse Event
      • Keyboard Events
      • Alert and Popup
      • Multiple Windows
      • iFrames
      • Wait WebElement
      • WebTable
  • FAQS
  • About Me & Feedback
    • Placed Students Feedback
    • Online Training Feedback
    • LinkedIn Profile
    • TechTalk
  • Free YouTube Courses
    • Python for Automation
    • Free QA Video Courses
      • Manual Testing
      • Java For Automation
      • Selenium Webdriver
      • TestNG
      • Cucumber BDD
      • UFT(QTP) Automation
    • Free Data Science Courses
      • Artificial Intelligence for Beginners
      • Python For A.I
      • Python Pandas
      • Python NumPy
      • Mathematics for A.I
  • Home
  • Selenium Java Online Training
  • Self Paced Video Course
    • Selenium Course Curriculum
    • Cypress Course Curriculum
    • Playwright Course Curriculum
  • Tutorials
  • Demo Sites
    • E-Commerce Demo Application
    • Practice Automation
      • Demo Page Healthcare
      • Registration Form
      • Transaction Details
      • DropDown
      • Mouse Event
      • Keyboard Events
      • Alert and Popup
      • Multiple Windows
      • iFrames
      • Wait WebElement
      • WebTable
  • FAQS
  • About Me & Feedback
    • Placed Students Feedback
    • Online Training Feedback
    • LinkedIn Profile
    • TechTalk
  • Free YouTube Courses
    • Python for Automation
    • Free QA Video Courses
      • Manual Testing
      • Java For Automation
      • Selenium Webdriver
      • TestNG
      • Cucumber BDD
      • UFT(QTP) Automation
    • Free Data Science Courses
      • Artificial Intelligence for Beginners
      • Python For A.I
      • Python Pandas
      • Python NumPy
      • Mathematics for A.I

Selenium Automation Testing

  • Introduction to Automation Testing
  • Introduction to Selenium
  • Advantages and Disadvantages of Selenium WebDriver
  • Locators in Selenium
  • How to launch the browsers ? 
  • Browser Navigation Commands in Selenium
  • Handling the textbox and button using selenium
  • Handling the radio button and checkbox using selenium
  • Handling the drop downs and multi-select dropdown
  • Validate the text validation and attributes values. 
  • Handling Images
  • Handling Mouse Events
  • Handling Keyboard Events
  • Handling Alert Popup
  • Handling iFrames
  • Handling Multiple Browsers or Tabs
  • Types of wait statement in selenium
  • How to take screenshots?
  • How to upload File in Selenium?
  • How to handle scroll function using JavaScriptExecutor?
  • How to handle basic functionality using JavaScriptExecutor?
  • How to handle advanced functionality using JavaScriptExecutor?
  • How to automate CAPTCHA?
  • How to handle cookies in selenium
View Categories
  • Home
  • Tutorials
  • Selenium Automation
  • Selenium Automation Testing
  • How to launch the browsers ? 

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

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+)

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 

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 

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

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

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)

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

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

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();

    }

}

Selenium Automation Testing
What are your Feelings
Share This Article :
  • Facebook
  • X
  • LinkedIn
Locators in SeleniumBrowser Navigation Commands in Selenium
© 2018 – 2025 Vinoth Tech Solutions Ltd (UK), Reg. No: 16489105