Locators

1
id=id of the element name=name of the element name=name_of_the_element filter=value_of_filter (attribute=value) link=link_text ++++++++++ CSS Selectors +++++++ css=tag#id css=tag.class css=tag[attribute=value] css=tag.class[attribute=value] css=tag:contains( inner text ) +++++++++++++ DOM : Document Object Model ++++ document.getElementById( id of the element ) document.getElementsByName( name )[index] document.forms[ name of the form ].elements[ name of the element ] document.forms[index of the form].elements[index of the element] document.forms[index of the form].elements[ name of the element ] ++++++++++++++ Xpath ++++++++++++++++++ Absolute : //html/body/div/div[1]/div/div/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[ 1]/input Relative : //*[@id='email'] //tag[@attribute="value"] //tag[@class="classname"] //tag[@id="idoftheelement"]

description

Selenium Locators

Transcript of Locators

Page 1: Locators

id=id of the element

name=name of the element

name=name_of_the_element filter=value_of_filter (attribute=value)

link=link_text

++++++++++ CSS Selectors +++++++

css=tag#id

css=tag.class

css=tag[attribute=value]

css=tag.class[attribute=value]

css=tag:contains(�inner text�)

+++++++++++++ DOM : Document Object Model ++++

document.getElementById(�id of the element�)

document.getElementsByName(�name�)[index]

document.forms[�name of the form�].elements[�name of the element�]

document.forms[index of the form].elements[index of the element]

document.forms[index of the form].elements[�name of the element�]

++++++++++++++ Xpath ++++++++++++++++++

Absolute ://html/body/div/div[1]/div/div/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[1]/input

Relative : //*[@id='email']

//tag[@attribute="value"]

//tag[@class="classname"]//tag[@id="idoftheelement"]