0% found this document useful (0 votes)
4 views1 page

Selenium Google Test Automation

The document contains a Java program that uses Selenium WebDriver to automate a test for Google. It opens the Google homepage, verifies the title, and checks for redirection to google.co.in. The program includes exception handling and ensures the browser is closed after execution.

Uploaded by

Akshata Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Selenium Google Test Automation

The document contains a Java program that uses Selenium WebDriver to automate a test for Google. It opens the Google homepage, verifies the title, and checks for redirection to google.co.in. The program includes exception handling and ensures the browser is closed after execution.

Uploaded by

Akshata Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package softwareTesting;

import [Link];
import [Link];

public class GoogleTest {


public static void main(String[] args) {
// Set ChromeDriver path (update path as per your system)
[Link]("[Link]", "C:\\Users\\[Link]\\
Desktop\\chromedriver-win64\\[Link]");

// Launch Chrome browser


WebDriver driver = new ChromeDriver();

try {
// Step 1: Open [Link]
[Link]("[Link]

// Step 2: Verify the title


String expectedTitle = "Google";
String actualTitle = [Link]();
if ([Link](expectedTitle)) {
[Link]("Title verification passed: " + actualTitle);
} else {
[Link]("Title verification failed. Found: " +
actualTitle);
}

// Step 3: Verify redirection to [Link]


String currentUrl = [Link]();
if ([Link]("[Link]")) {
[Link]("Redirect verification passed: " + currentUrl);
} else {
[Link]("Redirect verification failed. Found: " +
currentUrl);
}
} catch (Exception e) {
[Link]();
} finally {
// Close browser
[Link]();
}
}
}

You might also like