我正在使用Selenium IDE为我的站点编写测试,但是我无法让selenium使用上一个同级按钮单击按钮
<td> <div class="btn-group"> <button class="btn btn btn-danger block" title="Warning, Delete" name="delete" type="button"> <button class="btn btn btn-default block" title="View History" name="history" type="button"> <button class="btn btn btn-default block" title="View Settings" name="settings" type="button"> <button class="btn btn btn-default block" name="device" type="button"> <span class="glyphicon glyphicon-pencil"/> Arcade Reader </button> </div> </td>
我自己的路
xpath=//button[contains(.,'Arcade Reader')]/../preceding-sibling::button[@name='settings']
您无需升级并使用,..因为所有按钮都处于同一级别:
..
//button[contains(.,'Arcade Reader')]/preceding-sibling::button[@name='settings']