4 ms·
Does your product provide proper page objects? The way it's used in the examples (where the test specifies the direct page interactions) will quickly create dif
by giulianob 13y ago
Does your product provide proper page objects? The way it's used in the examples (where the test specifies the direct page interactions) will quickly create difficult to maintain code. For example, http://canvascode.wordpress.com/2013/11/20/maintainable-automated-ui-tests/ http://canvascode.wordpress.com/2013/11/20/maintainable-auto...
- mherrmann 13y agoGood question. The answer is no. You still need to write the page objects yourself. But it's much easier. Compare driver.findElement(By.xpath("//input[@type='text' and @value='First Name']"); with TextField("First Name"); Helium makes it much easier to identify the elements of the PageObject.
- giulianob 13y agoI 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.