News for hackers. Stuff that matters.
Re:Why Recorded/Playback Tests in Selenium Break by Terr_ on Tuesday April 18, 2017 @02:11AM (#14136843)
In terms of weak locators, I once wrote a Selenium-IDE plugin that would generate custom expressions. They were XPath-compatible (why throw away all those nice tools?) but the generation scheme strongly preferred using custom-attributes in the markup as the primary "signposts".

The goal was to make things a bit less fragile by allowing Devs to annotate markup, while avoiding retraining the screen-clicking QA or creating an entirely new locator scheme. This was back in 2010, but I think it generated expressions a bit like:

xpath=(((//.[@data-test-label='foo'])[1]//.[@data-test-label='bar'])[1]//.[@data-test-label='baz'])[1]/a

Messy looking, but it meant only a structural change to your foo/bar/baz structure would break the locator, or a particular change within the baz markup. Switching a div for a span or adding another nested div for some reason? No problem.

Unfortunately we never got to use it in production, the company was bought a couple years later and the new management wanted to skimp/dumb-down QA even further. I guess they wanted to buy results rather than processes.

There are no comments on this comment yet.