node-huxley icon indicating copy to clipboard operation
node-huxley copied to clipboard

Use xpath instead of coordinates

Open jhnns opened this issue 9 years ago • 2 comments

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.

jhnns avatar Feb 10 '15 00:02 jhnns

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?

chenglou avatar Feb 10 '15 05:02 chenglou

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.

jhnns avatar Feb 10 '15 14:02 jhnns