开发者

Make Selenium record IDs, not paths

When I use the FF plugin it records the paths of t开发者_Python百科he elements I interact with. In cases where the DOM is heavily-altered according to the user interaction, it is more convenient to element IDs, which are guaranteed not to be affected.

I can record everything and change paths to ID manually, but I was wondering of there is a more clever way to do this?


I don't think there is a way to do this. In my experience, you can't avoid heavy editing of test scripts for most pages that rely a lot on JS anyways (but that's of course not an answer). I often end up editing every other command (I also have had tests that I had to write in the final exported format from scratch - to allow conditions, loops and such).

Are you really creating so many scripts that this would make a difference? Is so, I guess you could modify the Selenium IDE extension (Firefox extensions are written mostly in JavaScript).


You could explore the concept of Selenium UI-Element Locators. I haven't used it, but it looks to provide a level of abstraction against varying paths

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜