Dashboard > Wonder > ... > How to Develop Selenium Tests > Selenium Command Examples
  Wonder Log In View a printable version of the current page.  
  Selenium Command Examples
Added by Kieran Kelleher, last edited by Kieran Kelleher on Nov 30, 2007  (view change)
Labels: 
(None)

Using XPath Expressions as Locators

Examples

Click a link having css class 'sel_create_team'

clickAndWait //a[@class='sel_create_team']  

Add the first element of a list browser (aka. 'select' element) to the current selections. The list browser is identified by css class 'sel_browser_list'

addSelection //select[@class='sel_browser_list'] value=0

Add the third element of a list browser (aka. 'select' element) to the current selections. The list browser is identified by css class 'sel_browser_list'

addSelection //select[@class='sel_browser_list'] value=2

Add the item named "John Murphy" of a list browser (aka. 'select' element) to the current selections. The list browser is identified by css class 'sel_browser_list'

addSelection //select[@class='sel_browser_list'] label=John Murphy

Store the current value of an input field into a script variable. The input field is identified by the css class "sel_EditTeam_teamName" and we are storing the current field value into a script variable named "var_EditTeam_teamName"

storeValue //input[@class='sel_EditTeam_teamName'] var_EditTeam_teamName

Use a stored variable later in the script (on a different page or whatever) to click a dynamic hyperlink that uses the stored value as the hyperlink text

clickAndWait link=${var_EditTeam_teamName}  

XPath Resources

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators