Thursday, November 3, 2011

How to use Css instead of Xpath in selenium

How to use Css instead of Xpath in selenium, Selenium Notes, Examples, Videos.By www.laxmiroy.blogspot.com/


Sometimes selenium gets confused to identify an element on the web page because more than one elements have the same name and ids so to handle this situation we instructs selenium to identify the object using CSS instead of Xpath.


<tr>
<td>open</td>
<td>http://economictimes.indiatimes.com/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>css=input[style='width: 120px; font-size: 12px;']</td>
<td>Business</td>
</tr>

No comments:

Post a Comment