0% found this document useful (0 votes)
42 views2 pages

Practical No 06

This document contains code for an automated test using Selenium that validates the title of a web page. The test launches Chrome and navigates to a URL, gets the actual title, compares it to an expected title, and prints whether the test passed or failed based on if the titles match.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Practical No 06

This document contains code for an automated test using Selenium that validates the title of a web page. The test launches Chrome and navigates to a URL, gets the actual title, compares it to an expected title, and prints whether the test passed or failed based on if the titles match.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical no 06

Testing.java
package test;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class testing {

public static void main(String[] args) {


String obj1="Hello";
String base="https://www.top-password.com/blog/fix-sleep-option-missing-in-
windows-power-menu/";
String expected_title="Fix: Sleep Option Missing in Windows 10 / 8 / 7 Power
Menu | Password Recovery";
System.out.println(obj1);
// TODO Auto-generated method stub
System.setProperty("webdriver.chromedriver", "C:/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.navigate().to("https://www.top-password.com/blog/fix-sleep-option-missing-
in-windows-power-menu");
driver.manage().window().maximize();
obj1=driver.getTitle();
System.out.println(obj1);
String actual_title=driver.getTitle();
if(actual_title.contentEquals(expected_title)){
System.out.print("TEST IS PASS");
}
else{
System.out.print("TEST IS FAIL");
}

}
OUTPUT :

You might also like