Two questions from a beginner.
Q1- Is it possible to assert the existence of an HTML node by ID and class? For example, to see if the following element exists:
You can combine the selectors.
For your first question, the following checks for a div with id "first" and class "drawer":
page.should have_css('div#first.drawer')
For your second question, the within
block can use the same css-selector as above:
within('div#first.drawer') do
Or if you really prefer xpath, you can do:
within("//div[@id='first' and @class='drawer']") do
A good reference for css-selectors: http://www.w3.org/TR/CSS2/selector.html