Selenium WebDriver Java Framework Course Limited Time Offer for $20

Selenium WebDriver Java Framework Course Limited Time Offer for $20

 

Print

Selenium Robot Framework Element Locator

Locating elements on the website under test is very important for all keywords in Selenium2Library to interact with the element. In general, finding an element on the page take an argument, locator. By default, when a locator is provided, it is matched against the key attribute of the particular element type. For example, id and name are key attribute to all elements, and locating elements is easy using just the id as a locator. 

 

When id or name is not present, Selenium2Library supports other strategies to locate the element. See the chart below for other strategies: 

Locator Example Description
identifier Click Element | identifier=my_element Matches by @id or @name attribute
id Click Element | id=my_element Matches by @id attribute
name Click Element | name=my_element  Matches by @name attribute
xpath Click Element | xpath=//div[@id='my_element'] Matches with arbitrary XPath expression
dom Click Element | dom=document.images[56] Matches with arbitrary DOM express
link Click Element | link=My Link Matches anchor elements by their link text
css Click Element | css=div.my_class Matches by CSS selector
jquery Click Element | jquery=div.my_class Matches by jQuery/sizzle selector
sizzle Click Element | sizzle=div.my_class Matches by jQuery/sizzle selector
tag Click Element | tag=div Matches by HTML tag name