- You run your Java program
You click Run in Eclipse / IntelliJ.
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
π Execution starts from the main() method.
βοΈ 2. Selenium starts ChromeDriver
Selenium locates the ChromeDriver executable
ChromeDriver starts as a separate server process
A new Chrome browser opens
π Now 3 things exist:
Your Java code
ChromeDriver (middle layer)
Chrome browser
π 3. A browser session is created
ChromeDriver creates a session like:
Session ID: 12345
Browser: Chrome
Status: Active
π This session is used for all communication
π 4. Selenium sends commands to browser
Example:
driver.get("https://example.com");
This is converted into a request:
Open URL β https://example.com
Sent like:
Java β ChromeDriver β Chrome browser
π 5. Browser loads the webpage
Chrome does:
Downloads HTML
Downloads CSS + JS
Builds DOM (Document Object Model)
Renders UI on screen
π Now you SEE the page
π³ 6. DOM is created in memory
Example:
Login
Becomes:
A DOM node inside browser memory
π€ 7. Selenium finds elements (WebElement creation)
Example:
WebElement btn = driver.findElement(By.id("login"));
What happens:
Selenium asks ChromeDriver:
π βFind element with id = loginβ
ChromeDriver searches DOM
Returns matching node
π Selenium gets a WebElement reference
π±οΈ 8. You perform actions
Example:
btn.click();
Flow:
Selenium β ChromeDriver β Browser β DOM click event
Browser then:
Executes click
Runs JS (if any)
Updates UI if needed
π 9. Each command repeats same cycle
Example:
driver.findElement(By.id("user")).sendKeys("admin");
driver.findElement(By.id("pass")).sendKeys("1234");
driver.findElement(By.id("login")).click();
Each step:
π Find element β Send command β Browser executes β Response
π§Ή 10. Closing browser
driver.quit();
What happens:
All tabs close
ChromeDriver session ends
Memory is released

Why WebDriver is called a ClientβServer Model
Because Selenium and the browser do NOT talk directly. Instead, they communicate through a structured requestβresponse system, just like a client and a server.
π§ Simple Definition
π Selenium WebDriver follows a clientβserver architecture where:
Client (Selenium code) sends requests
Server (Browser Driver + Browser) processes them
Response is sent back to the client
π§© Who is Client and who is Server?
πΉ Client Side
π Your Selenium test code
Example:
driver.findElement(By.id("login")).click();
β This is the request generator
πΉ Server Side (Two layers)
- ChromeDriver (Server bridge) Receives commands from Selenium Translates them into browser-understandable actions
- Chrome Browser (execution server) Actually performs actions Works with: Blink (rendering engine) V8 (JavaScript engine) π How communication happens CLIENT (Selenium Code) β HTTP Request SERVER (ChromeDriver) β Internal Commands BROWSER (Chrome) β DOM / UI updated β HTTP Response CLIENT (Selenium Code) π‘ Why HTTP communication?
Selenium uses:
W3C WebDriver Protocol (JSON over HTTP)
Example request:
POST /session/{id}/element
{
"using": "id",
"value": "login"
}
π ChromeDriver reads it and acts on the browser
π§ Why this design?
- Language independence π Client can be Java, Python, C#, JS Server (browser driver) understands standard protocol
- Browser independence π Same client works with: ChromeDriver GeckoDriver (Firefox) EdgeDriver
Top comments (0)