DATA SCIENCES AND MACHINE LEARNING TRAINNG STARTS ON 15-MAY-2021 ******************** NEW QA JOB PLACEMENT PROGRAM - STARTS ON 15-MAY-2021 ******************** DEVOPS+AWS TRAINING AND JOB PLACEMENT PROGRAM - STARTS IN JUN-2021 ******************** BUSINESS ANALYST JOB PLACEMENT PROGRAM - STARTS ON 15-MAY-2021

Sample Selenium Project Guru99 – Day 1 Code


// Day 1 Code for the Guru99 - Banking Project

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

public class projectlogin {
	
	@Test
	public static void logintest() {
		//Step 0.1: Invoke the browser 
		System.setProperty("webdriver.chrome.driver", "src//main//resources//chromedriver.exe");
		
		//Step 0.2: Create an object for the ChromeDriver Class
		WebDriver bank = new ChromeDriver();
		
		login(bank);

	}

	private static void login(WebDriver bank) {
		//Step 1: Open the Website
		String url = "http://www.demo.guru99.com/V4/";
		bank.get(url);
		
		
		//Step 1: Enter the username
		//mngr288729
		WebElement username = bank.findElement(By.xpath("//input[@name='uid']"));
		username.sendKeys("mngr288729");
		
		//Step 2:Enter the password 
		//upapAtE
		WebElement password = bank.findElement(By.xpath("//input[@name='password']"));
		password.sendKeys("upapAtE");
		
		//Step 2: Click on Login Button
		WebElement button = bank.findElement(By.xpath("//input[@type='submit']"));
		button.click();
	}

}