-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Adding support for getting an element's parent #505
Conversation
Just do |
@jnicklas is there a way to do that but lazy find the body? I'm trying to get back to the body from inside a within, so that I can check it loaded a popup.... |
@jnicklas looks like find(:xpath, '//body') works :D |
How is this not a useful addition? Not everyone is comfortable with xpath... I'd prefer to have a jquery like navigation available. Even more useful would be something like http://api.jquery.com/closest/ |
Sorry for dragging an old issue up. I don't agree with jnicklas. capybaras purpose is to allow us to test against a page, which may include finding an element then traversing to another element to check something. It may be slightly less common than click "somebutton" but its still valuable. |
+1 I would like this feature too, even if it's just syntactic sugar |
I'm not against this feature, though it is just syntactic sugar, so I find it a bit redundant. This pull request though is just completely wrong. So if someone wants this, please send a better pull request. |
What does |
@janko-m Its the context for the find which located the current element. |
@janko-m el = find('a')
el.find('b').parent # => returns el |
It seemed Capybara lacked a simple way to get an element's parent ( http://stackoverflow.com/questions/4861863/how-to-get-parent-node-in-capybara ) so I've added support for this.