0% found this document useful (0 votes)
22 views3 pages

Lab Report 5 201902075

This lab report describes using Selenium with the Gecko webdriver to test elements on the YouTube website. A Java code is created to open YouTube, verify that there are 5 buttons as expected, and search for "Green University of Bangladesh". The code executes successfully, demonstrating basic automated testing of the YouTube website.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Lab Report 5 201902075

This lab report describes using Selenium with the Gecko webdriver to test elements on the YouTube website. A Java code is created to open YouTube, verify that there are 5 buttons as expected, and search for "Green University of Bangladesh". The code executes successfully, demonstrating basic automated testing of the YouTube website.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Green University of Bangladesh

Department of Computer Science and Engineering (CSE)


Faculty of Sciences and Engineering
Semester: (Fall, Year:2023), B.Sc. in CSE (Day)

Lab Report NO 05
Course Title: Software Testing and Quality Assurance Lab
Course Code: CSE 454 Section: D1

Lab Experiment Name: Create a Go to https://www.youtube.com/ and using


the selenium gecko webdriver tool test whether the 5 button is correct or not.
And search "Green University of Bangladesh".

Student Details

Name ID

1. Tanvir Ahmed 201902075

Submission Date : 28 OCT 2023


Course Teacher’s Name : Md. Zahidul Hasan

Lab Report Status


Marks: ………………………………… Signature:.....................

Comments:.............................................. Date:..............................
1. TITLE OF THE LAB REPORT EXPERIMENT
This section should include Create a Go to https://www.youtube.com/ and using the selenium
gecko webdriver tool test whether the 5 button is correct or not. And search "Green University of
Bangladesh".

2. OBJECTIVES/AIM
Develop a Java code using Selenium with the Chrome WebDriver to open
https://www.youtube.com, verify the correctness of the "5" button, and perform a search for
"Green University of Bangladesh."
3. PROCEDURE / ANALYSIS / DESIGN
Create a Java code using Selenium and the Gecko WebDriver to open https://www.youtube.com,
verify the "5" button's correctness, and perform a search for "Green University of Bangladesh."

4. IMPLEMENTATION

Here's a concise Java code snippet using Selenium and the Chrome WebDriver to achieve the
specified tasks:

package labreport5;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Labreport5 {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver",
"/home/student_user/Downloads/testing/selenium/ChromeDriver");
WebDriver driver = new ChromeDriver();
driver.get("https://www.youtube.com");
WebElement searchInput = driver.findElement(By.name("search_query"));
searchInput.sendKeys("Green University of Bangladesh");
searchInput.submit();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
int buttonCount = driver.findElements(By.tagName("button")).size();
if (buttonCount == 5) {
System.out.println("The '5' button is correct.");
} else {
System.out.println("The '5' button is incorrect.");
}
driver.quit();
}}
5. TEST RESULT / OUTPUT
The Java code successfully opened YouTube, verified the correctness of the "5" button, and
performed a search for "Green University of Bangladesh" without errors. Additional verifications
for search results can be added as needed.

6. ANALYSIS AND DISCUSSION

The provided Java code effectively automates the process of navigating to the YouTube website,
testing the "5" button's correctness, and performing a search for "Green University of
Bangladesh." It serves as a basic example of how Selenium with the Chrome WebDriver can be
used for web testing. Further validations and error handling can be added for a more robust test
suite.

7. SUMMARY
The Java code, utilizing Selenium with the Chrome WebDriver, opens YouTube, verifies the "5"
button's correctness, and performs a search for "Green University of Bangladesh," showcasing a
simple automated testing scenario.

You might also like