-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: XPath support #250
Comments
You could try my test recorder which will generate the paths. |
@quantuminformation thanks, but I know how to find paths, I'd just like to make them less brittle and no recorder will help me with this if xPath is not supported :) |
Whats the attraction with XPath, first time I've heard that css selectors weren't up to the task.) |
Finding elements by the visible text allows us to write tests that find the elements in the same way that the user does. This is one of the guiding principles of testing library. It would be nice to be able to do this with This way the test depends less on the implementation of the component/thing/whatever and more on what the user sees/uses. One way to solve this could be to allow us to send in an element rather than a selector so we can use whichever selecting method we want :) |
I think this can help #567 |
I'm currently looking for a framework for ember e2e tests that handles promises without waits and sleeps, but I need XPath support to be able to define more complicated page elements in page objects.
For the tests not to be flaky, I can't use selectors like
nth child
- I rely very much on extracting the text from elements by using helpers likecontains
,following
, logic operators and node functions - I use a lot of items from this cheatsheet http://ricostacruz.com/cheatsheets/xpath.html.Examples of my elements:
//td//*[contains (text(), '" + field_name + "')]/../..
(field_name is passed as a param in function)//td//*[contains (text(), 'name')]/../../following::td//option[@value='response." + el_name + "']
(el_name passed as a param in function)//div[contains(@class, 'wysiwyg-creator-column') and not(contains(@class, 'ng-hide'))]//button[@ng-click='createNewElement()']/..
Overall, XPath is more versatile than CSS. It would be awesome if it could be supported. Thanks!
The text was updated successfully, but these errors were encountered: