4 ms·
I just recommend instead using a custom data- attribute to identify your elements so you don't rely either on text, HTML structure, or CSS classes since all of
by giulianob 13y ago
I just recommend instead using a custom data- attribute to identify your elements so you don't rely either on text, HTML structure, or CSS classes since all of those can change but may not affect functionality therefore should not break your test.
- mherrmann 13y agoThat's surely a good solution. It requires write access to the source code of the web application being automated though. That's not to say that Helium is a silver bullet. It certainly always depends on the context. For instance, I know of a bank here in Austria that generates a lot of the Java source code for their internet banking app from an abstract model. They also generate page object code immediately from this abstract model, which is therefore always up to date and precise. This is one example where I would say using Helium would probably not pay off.
- Terr_ 13y agoI ended up writing a Selenium-IDE plugin for a similar thing with hierarchical "data-test-label" attributes, since our test-team seemed unwilling to actually learn XPath, and the default Selenium-IDE output was far too hyper-specific and brittle. Ugly but standards-following output: xpath=((( //.[@data-test-label='foo'])[1] //.[@data-test-label='bar'])[1] //.[@data-test-label='baz'])[1] /a This defines a three-step search which skips over a lot of probably-unimportant tags.