Get node's parent element with Capybara

Updated . Posted . 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
konjoot
Posted by konjoot to wiki (2013-12-19 16:01)