Viplove QA - SDET

When you write:


WebDriver driver = new ChromeDriver();


Here’s what exactly happens step by step:


✅ 1. ChromeDriver() object is created

ChromeDriver is a class provided by Selenium that implements the WebDriver interface.

When you create new ChromeDriver(), it:

Launches a new instance of the Chrome browser.

Internally starts the ChromeDriver server (a small executable).

This server acts as a bridge between your Java code and the actual Chrome browser using the WebDriver JSON Wire Protocol or W3C WebDriver protocol.



✅ 2. Assigning it to a WebDriver reference

WebDriver driver is an interface reference.

This enables polymorphism, so you can later switch to FirefoxDriver, EdgeDriver, etc., without changing the rest of your code.


WebDriver driver = new FirefoxDriver(); // Also valid


✅ 3. Establishing communication

Once the ChromeDriver is initialized:

It launches the Chrome browser.

It opens a communication port (like localhost:9515).

The browser is controlled via commands sent through this port (e.g., open URL, click element).


✅ 4. Default settings

If no specific ChromeOptions are passed, it launches Chrome with default settings.

You can modify it using:

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
WebDriver driver = new ChromeDriver(options);

5 months ago | [YT] | 0