202-D-RAJ SINGH
LOCATOR
Code:
package Assignmet12;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Demolocator {
    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "D:\\sachin\\chromedriver.exe");
        WebDriver wd = new ChromeDriver();
        wd.get("http://demo.guru99.com/test/newtours/");
        wd.findElement(By.name("userName")).sendKeys("Admin123");
        wd.findElement(By.name("password")).sendKeys("admin123");
        wd.findElement(By.name("submit")).click();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        wd.quit();
Output:
                             202-D-RAJ SINGH
2. Locator with orange HRM
                                       202-D-RAJ SINGH
Code:
package Assignmet12;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class LocatorsProgram {
public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver", "D:\\sachin\\chromedriver.exe");
        WebDriver wd = new ChromeDriver();
        wd.get("https://opensource-demo.orangehrmlive.com/");
        wd.manage().window().maximize();
        wd.findElement(By.name("username")).sendKeys("Admin");
        wd.findElement(By.name("password")).sendKeys("admin123");
        wd.findElement(By.xpath("//button[@type='submit']")).click();
        wd.findElement(By.xpath("//span[text()='Welcome']")).click();
        wd.findElement(By.linkText("Logout")).click();
        wd.quit();
Output:
                   202-D-RAJ SINGH
Adding jar files