开发者

How do I manage with dynamic id's

开发者 https://www.devze.com 2023-01-06 02:42 出处:网络
I am automating a test case, where I need to fo开发者_开发百科cus 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 q

I am automating a test case, where I need to fo开发者_开发百科cus 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.


Have you tried this:

element.onclick = function(){
  alert(this.id);
};


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

0

精彩评论

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