开发者

Selenium - Clicking on image which has random id

Below is the code, and the imd id is randomly generated. i want to click on the image to remove a data in the grid. but note, this image is present in more grids. so if i give src it is removing the first data and not the required data which i want.

img id="img30" onclick="removeTest("30A0");" onmouseout="hideImage('img30')" src="resources/images/button开发者_JAVA技巧_delete.gif" style="visibility: hidden;"/>


You can navigate beackwards in xPath-expressions using "/../" so you may just locate your data-row and then move up, an click the image

like this

click //div[@id="yourDataGrid"]//tr//td[contains(text(),"whateverdataYouWantToDelete")]/..//img
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜