【发布时间】:2012-08-15 14:01:47
【问题描述】:
在代码中:
<img style="cursor: pointer; background-color: transparent;" onclick="changeTeamHint(2155);" src="/images/icon_edit_inactive.png">
onclick="changeTeamHint(2155);" 总是在变化。随着我在表单中添加更多字段,这个数字会增加。
如何获取 Selenium IDE 中的最后一个元素?例如,如果我添加一个带有"changeTeamHint(2156)" 的文本字段,如何使用 Selenium IDE 选择最新的?如果是 2157,则选择 2157。等等
这是我目前得到的:xpath=(//img[@style='cursor:pointer;'])[last()]
但我的同事告诉我尝试通过 onclick 找到它,这就是我得到的有效方法:xpath=(//img[@onclick='changeTeamHint(2155);'])[last()]
我试过:xpath=(//img[@onclick='changeTeamHint();'])[last()],但它给了我一个错误
【问题讨论】: