Locator Type and syntax
|
Locator Type
|
Syntax
|
Description
|
|
id
|
driver.findElement(By.id(“ID_of_Element”))
|
Locate by value of
the “id” attribute |
|
className
|
driver.findElement(By.className(“Class_of_Element”))
|
Locate by value of
the “class” attribute |
|
linkText
|
driver.findElement(By.linkText(“Text”))
|
Locate by value of the
text of the hyperlink |
|
partialLinkText
|
driver.findElement(By.partialLinkText(“PartialText”))
|
Locate by value of the
sub-text of the hyperlink |
|
name
|
driver.findElement(By.name(“Name_of_Element”))
|
Locate by value of the
“name” attribute |
|
xpath
|
driver.findElement(By.xpath(“Xpath”))
|
Locate by value
of the xpath |
|
cssSelector
|
driver.findElement(By.cssSelector(“CSS
Selector”))
|
Locate by value of
the CSS selector |
|
tagName
|
driver.findElement(By.tagName(“input”))
|
Locate by value of
its tag name |
No comments:
Post a Comment