Thursday, 15 January 2015

selenium webdriver - xpath: how select radio button of particular item if html is equal and order could be changed -



selenium webdriver - xpath: how select radio button of particular item if html is equal and order could be changed -

how can click on radio button using xpath in selenium if have next html:

<tr> <td> <input type="radio" onclick="onselect(this.form)" value="met" name="selected_item"/> </td> <td> val1</td> <td> 1</td> <tr> <td> <input type="radio" onclick="onselect(this.form)" value="met" name="selecteditem"/> </td> <td> val2</td> <td> 1</td>

solution have found decision:

.//tr[td[contains(., 'val1')]]/td[1]/input

//td[text()=' val1']/preceding-sibling::td/input

or

//td[text()=' val2']/preceding-sibling::td/input

xpath selenium-webdriver

No comments:

Post a Comment