0% found this document useful (0 votes)
16 views

STQA-P3

Uploaded by

dcruzsophia24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

STQA-P3

Uploaded by

dcruzsophia24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

PRACTICAL 3

AIM: Install Selenium Server and demonstrate its usage by executing a script in Java to
automate browser actions.

Step 1 Download Selenium Standalone Server

1. Download the Selenium Server: Visit the Selenium Downloads page and download the
Selenium Server (selenium-server-standalone.jar).

Step 2: et Up Your Project in NetBeans

1. Open NetBeans: Start the NetBeans IDE.


2. Create a New Project:
o Go to File > New Project.
o Select Java under Categories and Java Application under Projects.
o Click Next.
o Name your project (e.g., STQA-P3) and choose a location for the project.
o Click Finish.

Step 3: Add Selenium JAR Files to Your Project

1. To add JAR Files to NetBeans: Right-click on your project in the Projects window and
select Properties.
2. Select Libraries from the categories on the left.
3. Click Add JAR/Folder.
4. Navigate to the directory where you downloaded the Selenium server jar file.
5. Add all the JAR files in the libs folder and the selenium-server-standalone.jar

Ms. Sophia Dcruz STQA-P2


Step 4: Write a Selenium Script

1. Create a New Java Class:


o Right-click on the Source Packages folder in the Projects window.
o Select New > Java Class.
o Name your class (e.g., Test3).
o Click Finish

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class StqaP3
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:/Users/Mathe/OneDrive/Desktop/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("https://www.selenium.dev/selenium/web/web-form.html");
String a= driver.getTitle();
System.out.println(a);
WebElement textBox = driver.findElement(By.name("my-text"));
WebElement submitButton = driver.findElement(By.cssSelector("button"));
textBox.sendKeys("Selenium");
submitButton.click();

WebElement message = driver.findElement(By.id("message"));


String mess= message.getText();
System.out.println(mess);
driver.quit();
}

Step 5: Run the Test Suite

1. Select the test suite you created.


2. Click on the "Run" button to execute all the test cases in the suite.
3. Review the test results to ensure all test cases pass successfully.

Ms. Sophia Dcruz STQA-P2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy