//tagname[@attribute='value']
driver.findElement(By.xpath("//input[@placeholder='Name']"))
2. By index of the attribute
//tagname[@attribute='value'][index]
driver.findElement(By.xpath("//input[@type='text'][2]"))
Used when your attribute and the value are same for multiple elements
3. By tagnames when there are many instances of the childtag.
//parenttag/childtag[index])
driver.findElement(By.xpath("//form/input[3]"))
Use index when there are many instances of child tag and you have to locate one of them.)
4. By parent to child-tag
//parenttag[@attribute='value']/childtag[index])
driver.findElement(By.xpath(" //div[@class='forgot-pwd-btn-conainer']/button[1]"))
5. With regular expression
//tagname[contains(@class,'value')]
driver.findElement(By.xpath("//button[contains(@class,'submit')]"))