Types :
For Example : driver.findElement(By.id(userid));
Finding elemeny by name :
driver.findElement(By.name("logon"));
Finding element by link:
driver.findElement(By.linkText("rank list"));
driver.findElement(By.partialLinkText("rank"));
Finding element by Xpath:
-- To find xpath user can use fire bug.
//table/tr[2]/td/input
//input[@id='item_quantity']
(//table[@name='cart']//input)[2]
//input[contains(@class,'required')]
//input[contains(@class,'required') and type='text']
some more options..
// xpath iposition
//Xpath relative
Finding element by CSS
driver.findElements(By.css("input[class~='required']"));
driver.findElements(By.class("required"));
Finding elements by DOM
document.forms[0].elements[0]
document.forms['loginOut'].elements['username']
- Finding element by id
- Finding elemeny by name
- Finding element by link.
- Finding element by Xpath.
- Finding element by CSS
- Findidng element by DOM
- Finding child eleme
driver.findElements(By.class("required"));
No comments:
Post a Comment