How to store the text of and element which css attributes ends with some specific letters, Selenium Notes, Examples,Videos, By.www.laxmiroy.blogspot.com/
Ex. in above element how to store the text whose element name ends with "foo"
Selenium IDE
<tr>
<td>storeText</td>
<td>css=a[name$="foo"]</td>
<td>str</td>
</tr>
Selenium RC
String str = selenium.getText("css=a[name$=\"foo\"]");
This will store the "barfoo" in str variable because element <a name="barfoo">barfoo</a> name ends with "foo"
How to store the text of and element which css attributes starts with any letters and ends with any letters but containing some specific letters in middle.
Ex. in above element how to store the text whose element name ends with any letter and ends with any letter but containing some specific letters "zoo"
Selenium IDE
<tr>
<td>storeText</td>
<td>css=a[name*="zoo"]</td>
<td>str</td>
</tr>
Selenium RC
String str = selenium.getText("css=a[name*=\"zoo\"]");
This will store the "foozoobar" in str variable because element <a name="foozoobar">foozoobar</a> name contains "zoo" in the middle.
There is another method to store
String str = selenium.getText("css=a:contains(\"zoo\")");
No comments:
Post a Comment