Lai Yu-Hsuan
Lai Yu-Hsuan

Reputation: 28071

where is documentation of Rspec?

I saw have_selector first time today. I want to learn it's options, so I went to official site.

But I can't find it anywhere.

I used the search feature in each of the above sites, but in vain.

It's just a small, common method, right? But I can't even read it's API... where is it?

Edit: I use Webrat. Now I know have_selector is from it. But seems no useful documentation.

Upvotes: 4

Views: 2370

Answers (1)

Victor Deryagin
Victor Deryagin

Reputation: 12215

That is one of Capybara's Rspec matchers: Capybara::RSpecMatchers#have_selector.

You can use that method for querying the page for the existence of certain elements using css or xpath notation (examples from Capybara's Readme):

page.should have_selector('table tr')
page.should have_selector(:xpath, '//table/tr')

Upvotes: 2

Related Questions