Get node's parent element with Capybara

Posted Over 10 years ago. Visible to the public. Repeats.

To get parent of Capybara's node do the following:

node = page.find '#selector'
parent = node.find(:xpath, '..')
parent_of_parent = node.find(:xpath, '../..')

konjoot
Last edit
About 6 years ago
konjoot
Posted by konjoot to wiki (2013-12-19 16:01)