WebDriver commands for elements

WebDriver Commands 

There are different ways by which one can read/identify various page elements.
  1. By Id
  2. By Xpath
  3. By linktext
  4. By Partiallinktext
  5. By cssselector
  6. By tagname

Among all of these id selection is better and best programming practice. Usually in hesitation most of the QE automation engineers select through xpath.

Example:

driver.findelement(By.xpath(".//*[@id='navbar']/ul[2]/li[6]/a"))
driver.findElement(By.name("email"));

and likewise.
 

Comments

Popular Posts