How to record the script for dynamic ID generation in Selenium

丶灬走出姿态 提交于 2020-01-06 04:07:05

问题


I am working on Selenium IDE. Currently I am facing problem related to dynamic id. I have recorded one script, but when I run it again it fails because id changes every time.

Is there any way to get rid of this?? Waiting for reply

thanks in advance


回答1:


You should use other type of locators (for example xPath - as Pavel Janicek wrote).
Here is an article about Selenium locators http://www.qaautomation.net/?p=188
Read it and choose the best way for you.




回答2:


Generally - try switching from ID search to XPath. See examples here: http://zvon.org/xxl/XPathTutorial/Output/example1.html

But in that case you have to know that your element is always first SPAN of second table (just example)



来源:https://stackoverflow.com/questions/8817869/how-to-record-the-script-for-dynamic-id-generation-in-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!