STQA-P3
STQA-P3
AIM: Install Selenium Server and demonstrate its usage by executing a script in Java to
automate browser actions.
1. Download the Selenium Server: Visit the Selenium Downloads page and download the
Selenium Server (selenium-server-standalone.jar).
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
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();