Skip to content
CodeKruPro

Open a browser, open a page and print its title

Automation taskEasyAsked in: Accenture, Capgemini, Infosys, Swiggy, TCS, Tech Mahindra

Many live rounds open with: "Start Chrome, go to this URL, print the page title and close the browser." It checks that you can start a session, navigate and clean up without help.

Put the call that closes the browser in a finally block (code that runs whether or not an error happened), so the browser never stays open when a step fails.

Your First Selenium Script

Video walkthrough

Watch on YouTube

Your First Selenium Script

Welcome to Selenium! In this first assignment, you will:

  1. Create a ChromeDriver instance
  2. Navigate to a webpage using driver.get()
  3. Get the page title using driver.getTitle()
  4. Close the browser with driver.quit()

Task:

  1. Navigate to https://testkru.com/Elements/TextFields
  2. Print the page title

Expected output:

Title: Text Fields
Read full tutorial on Codekru