tags:

views:

40

answers:

2

I am automating a test case, where I need to focus on a link, then I have to click on a element say element id looks like //table[@id='562']/tbody/tr/td[2]/img, but the value inside quotes that is 562 is keep changing how can i find out and click that element. Please can any body help me.

A: 

Have you tried this:

element.onclick = function(){
  alert(this.id);
};
digitalFresh
sorry am not getting how to use this can u explain me more clearly.. thank u
nagaraja
A: 

Write the same value out to a variable and use that to find the element.

Andy Robinson
Thank u andy. but the problem is, in this test case am going to upload a file and those files arranged row wise. i have to search that document and click that elmenent mentioned above but once i uploaded a document it may come in any row and the id attribute contain any value. There is no order for the value.So i cant predict the value.. so is there any other solution... please..
nagaraja
How would you know which item to click?
Andy Robinson