-
Notifications
You must be signed in to change notification settings - Fork 61
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
Remove xpath/html #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM A couple of Capybara's specs that still use HTML methods will need to be updated, and a documentation example but nothing major.
This is a hugely breaking change! 😄 I'm surprised no one has objected. I just upgraded my xpath gem from a I can understand your reasons for removing this. Keeps this gem simple and focused. Just wondering if there is a recommended upgrade path for those who want to keep using the nice selectors from For now, I guess my workaround will just be:
|
@TylerRick I'd say just copy the previous version of the file into your project if you still want it, or just lock to < 3.0 on the gem version. If you don't mind me asking, what are you using them for? |
I personally found the HTML selectors very helpful when defining custom Capybara selectors. For example: Capybara.add_selector(:select2_field) do
# Find select2-container objects that point to fields with the given name
xpath { |field_name| "#{XPath.css("div.select2-container")}[substring(./@id, 6) = (#{XPath.anywhere(XPath::HTML.field(field_name).attr(:id))})]" }
end |
@Ajedi32 Just an FYI -- you'd be better off returning an XPath::Expression from that rather than a string. Going off your expression it would be something like
|
Funny story... I think enabling that exact line of code to return an XPath::Expression was actually my motivation for writing b9afe8a back in 2013. I just never got around to fixing it in the application after the commit made it into a release. Thanks for the reminder. 😄 |
Late response, but I was using them in custom selectors and things, similar to @Ajedi32. I'd also added a def select_or_input(locator)
locator = locator.to_s
xpath = descendant(:input, :select)[~attr(:type).one_of('submit', 'image')]
xpath = locate_field(xpath, locator)
xpath
end |
This is obviously a hugely breaking change, and would necessitate bumping the major version to 3.0, but since these are no longer used by Capybara, I think it's just confusing to have them be part of the gem.