views:

39

answers:

1

I have this

Then /^the "([^\"]*)" tag with the id "([^\"]*)" should have the style "([^\"]*)"$/ do |tag,id,style|
  if page.respond_to? :should
      page.should have_selector(tag, :id => id, :style => style)
    else
      assert page.has_selector?(tag, :id => id, :style => style)
    end
end

And This is my cuke step

    And the "div" tag with the id "preview" should have the style "display: block;"

And this is the error I get:

undefined method `has_selector?' for #<Capybara::Session:0x1065b5fc0> (NoMethodError)

Any ideas?

+1  A: 

Try to use something similar to page.should have_xpath("//tag[@class='class', @id='id']")

Then /^I should see trivial div$/ do 
  page.has_xpath?("//div[@style='display:none' and @id='my_form']") 
end 

this one definitely works

Bohdan Pohorilets
got this error NativeException: java.lang.RuntimeException: Could not retrieve XPath >//div[@style='display: none;', @id='preview']< on HtmlPage(http://cucumber.test.com/objects/dance-dance-dance/build)@1286076580 (Culerity::CulerityException)
DerNalia