Thursday, 14 December 2017

Different ways to write xpath

way 1:
Xpath syntax 1 - //tagName[@attribute='value']
way 1 - driver.findElement(By.xpath("//input[@id='email']")).sendKeys("hello");
way 2:
Xpath syntax 2 - //*[@attribute='value']
way 2 - driver.findElement(By.xpath("//*[@id='email']")).sendKeys("hello");

Note : here, * represents tagName (* verifies directly where //*[@id='email'])

No comments:

Post a Comment