You are on page 1of 7

Joyal Georgi

TYCS A (8845)
(4B)

Steps:

Step 1: Follow all the installation steps mentioned in Practical 4(A)

Step 2: Open eclipse & create a new java project > Give name to it & finish

Step 3: Give any module name for module-info.java file & then create
Joyal Georgi
TYCS A (8845)
Step 4: Click on project created > Build path > configure build path & below screen will
be visible

Step 5: Select classpath > Add Library > JRE System Library > select Workspace
default JRE(JDK- 19) > finish

Step 6: Again select classpath > Add External Jars > select folder where all files are
stored & select all files > open
Joyal Georgi
TYCS A (8845)

Step 7: Repeat step 6 but now select all files from ‘lib’ folder

Step 8: Apply & close the ‘java build path’


Joyal Georgi
TYCS A (8845)
Step 9: Delete the ‘module-info.java’ file from project

Step 10: Select project > new > class > put package name & class name > finish

Step 11: Search any website > right click on it > inspect > copy title from code visible on
right
Joyal Georgi
TYCS A (8845)
Code:

package abc;

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

public class Prac4b {


public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
String baseUrl = "https://www.imdb.com/title/tt0069576/";
String expectedTitle = "Doraemon (TV Series 1979–2005) - IMDb";
String actualTitle = " ";
driver.get(baseUrl);
actualTitle = driver.getTitle();
if(actualTitle.contentEquals(expectedTitle)) {
System.out.println("Test Passed");
}
else {
System.out.println("Test Failed");
}
driver.close();
}
}

● ( In the above code, expectedTitle will be the title we copied at step 11 & baseUrl
will be link of website )

Output:

● If the expectedTitle in code is incorrect then the output will be ‘Test Failed’
Joyal Georgi
TYCS A (8845)

Errors:

● For step 7 & 8, if you get this type of error then remove the ‘JRE system Library’
from ‘Classpath’ > apply & close
Joyal Georgi
TYCS A (8845)

● After running the project, if boot layer error occurs then:


Click on project > build path > configure build path > libraries > select ModulePath >
JRE System library > select Execution Environment > finish

You might also like