Wiki source code of Selenium Command Examples
Version 7.1 by Kieran Kelleher on 2007/11/30 14:12
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | == Using XPath Expressions as Locators == | ||
2 | |||
3 | Click a link having css class 'sel//create//team' | ||
4 | |||
5 | | clickAndWait | ~/~/a@class='sel//create//team' | | | ||
6 | 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' | ||
7 | | addSelection | ~/~/select@class='sel//browser//list' | value=0 | | ||
8 | 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' | ||
9 | | addSelection | ~/~/select@class='sel//browser//list' | value=2 | | ||
10 | 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' | ||
11 | | addSelection | ~/~/select@class='sel//browser//list' | label=John Murphy | | ||
12 | 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" | ||
13 | | storeValue | ~/~/input@class='sel//EditTeam//teamName' | var//EditTeam//teamName | | ||
14 | 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 | ||
15 | | clickAndWait | link=$var//EditTeam//teamName | |