Created
February 17, 2021 06:00
-
-
Save ultimate-qa2/1ebee33ff19ddd94dd55eb58d6672702 to your computer and use it in GitHub Desktop.
Selenium Locators in Selenium Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sign In Link by ID | |
driver.findElement(By.id("sign-in")); | |
// Sign In Button by Name | |
driver.findElement(By.name("commit")); | |
// Home Link by Class Name | |
driver.findElement(By.className("nav-item")); | |
// Sign In Link by Tag Name | |
driver.findElement(By.tagName("a")); | |
// Sign In Link by CSS | |
driver.findElement(By.cssSelector("a[data-test=sign-in]")); | |
// Sign In Link by XPath | |
driver.findElement(By.xpath("//a[@data-test='sign-in']")); | |
// Sign In Link by Link Text | |
driver.findElement(By.linkText("Sign in")); | |
// Sign In Link by Partial Link Text | |
driver.findElement(By.partialLinkText("Sign")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment