Stqa P4
Stqa P4
AIM: Write a program using Selenium WebDriver to automate the login process on a specific
web page. Verify successful login with appropriate assertions
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.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/**
*
* @author Sophia
*/
public class STQA_P4 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:/Users/Mathe/OneDrive/Desktop/chromedriver.exe");
WebDriver driver = new ChromeDriver();
ChromeOptions options = new ChromeOptions(); // URL of the login website that is
tested
driver.get("https://auth.geeksforgeeks.org/"); // Maximize window size of browser
driver.manage().window().maximize(); // Enter your login email id
driver.findElement(By.id("luser")).sendKeys("[email protected]"); // Enter
your login password
driver.findElement(By.id("password")).sendKeys("xyz12345");
driver.findElement(By.className("signin-button")).click();
System.out.println("Test executed successfully!");
driver.quit();
}