Ruby on Rails: Xpath: Could not retrieve XPath
This is the error I get:
NativeException: java.lang.RuntimeException: Could not retrieve XPath >//id[@class='open'//@id='status_open']< on HtmlPage(http://cucumber.test.com/proposals/view-me/edit#)@17325460 (Culerity::CulerityException)
This is my Cucumber command
Then the "li" tag with the id "status_open" should have the class "open"
This is my step definition
Then /^the "([^\"]*)" tag with the id "([^\"]*)" should have the class "([^\"]*)"$/ do |tag,id,clas|
if page.respond_to? :should
page.should have_xpath("//#{tag}[@class='#{clas}',@id='#{id}']")
else
assert开发者_开发技巧 page.have_xpath("//#{tag}[@class='#{clas}',@id='#{id}']")
end
end
and here is the HTML:
<li class="open" id="status_open">
<a href="#">
Open
</a>
</li>
it seems like it should work, based on this tutoraial:
http://www.w3schools.com/xpath/xpath_syntax.asp
Ideas?
//id[@class='open'//@id='status_open']
is not a syntactically correct XPath expression.
I have to guess... Maybe you wanted:
//li[@class='open' and @id='status_open']
精彩评论