Showing posts with label object identification. Show all posts
Showing posts with label object identification. Show all posts

Tuesday, 10 January 2012

Object Identification In Selenium


Element Locators tell Selenium which HTML element a command refers to.

Identifiers
Syntax1
Syntax2
Comments
id
id =id
id
Select the element with the specified @id attribute
name
name=username
username
Select the first element with the specified @name attribute
dom
dom=document.images[1]
Find an element using JavaScript traversal of the HTML DOM
xpath
xpath=//img[@alt='do]
//img[0]
Locate an element using an XPath expression
link
link=The link text
Select the link (anchor) element which contains text matching.
CSS
css=a[href="#id3"]
Select the element using css selectors