Day-2-Locators

package launchBrowser;
 
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
 
public class Day_2_Locators {
 
static WebDriver driver;
 
public static void main(String[] args) {
 
System.setProperty("webdriver.chrome.driver", "G:\\Lib\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
 
 
 
/*
 
driver.findElement(By.id("edit-name")).sendKeys("admin"); // id locator
 
driver.findElement(By.name("pass")).sendKeys("Selenium"); // name locator
 
// driver.findElement(By.className("form-submit")).click(); // className locator
 
driver.findElement(By.cssSelector("input.form-submit")).click();
 
*/
 
// driver.findElement(By.linkText("Vishleshana")).click(); // linkText locator
// driver.findElement(By.linkText("Photos")).click(); // linkText locator
 
// driver.findElement(By.partialLinkText("Greater News")).click(); // partialLinkText
 
driver.findElement(By.xpath("/html/body/div[2]/div/div[2]/main/div/section/div/div[1]/form/div/div[1]/input")).sendKeys("admin");
 
driver.findElement(By.xpath("//*[@id=\"edit-pass\"]")).sendKeys("password");
 
driver.findElement(By.xpath("//*[@id=\"edit-submit\"]")).click();
 
}
 
}