π Parent Note
π€ By using find method
expect(find('div.greet > h1').text).to eq 'Hello'
expect(find('div.greet > p.message').text).to eq "world"
π By using within method
within('div.greet') do
  expect(find('h1').text).to eq 'Hello'
  expect(find('p.message').text).to eq "world"
end
π Method: Capybara::Session#within β Documentation for jnicklas/capybara (master)
    
    
Top comments (1)
Sometimes it's also necessary to break out of any
withinscoping applied, for example in a helper. Usepage.documentto get back to the unscoped variant.