Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created March 8, 2011 21:59
Show Gist options
  • Save michaeltwofish/861176 to your computer and use it in GitHub Desktop.
Save michaeltwofish/861176 to your computer and use it in GitHub Desktop.
Using XPath in webrat to specify that one element should come before another. Using id but could use anything.
Then /^I should see element "([^"]*)" before element "([^"]*)"$/ do |first, second|
xpath = "//*[@id='#{first}']/following-sibling::*[@id='#{second}']"
response_body.should have_xpath(xpath)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment