node-huxley
node-huxley copied to clipboard
Use xpath instead of coordinates
What do you think about specifying an xpath instead of coordinates for a click action? This is probably more useful because I don't want to re-record my tests when I changed the location of a button.
With document.evaluate()
you're able to get a reference of the DOM element.
But if you refactor the underlying DOM structure without changing the look, then it'd break right?
It seems like breaking when the button changes location is a desired behaviour?
Yes, you're right. But re-recording the test is more work than adjusting an xpath. And the acceptance criteria are usually not "click at 300,400", but "click on red button". And "red button" is probably best described via an xpath.
But you could leave that decision up to the developer. Both coordinates and xpath should be valid.