Check select box has certain options with Capybara

Try using the capybara rspec matcher have_select(locator, options = {}) instead: #Find a select box by (label) name or id and assert the given text is selected Then /^”([^”]*)” should be selected for “([^”]*)”$/ do |selected_text, dropdown| expect(page).to have_select(dropdown, :selected => selected_text) end #Find a select box by (label) name or id and assert the … Read more

How to fill hidden field with Capybara?

You need to locate the hidden field and set its value. There are a couple ways, this is probably the simplest find(:xpath, “//input[@id=’my_hidden_field_id’]”).set “my value” If you’re executing a client_side script in production, you could just tell capybara to run it with a javascript-compliant driver page.execute_script(“$(‘hidden_field_id’).my_function()”)

Capybara: How to test the title of a page?

Since the version 2.1.0 of capybara there are methods on the session to deal with the title. You have page.title page.has_title? “my title” page.has_no_title? “my not found title” So you can test the title like: expect(page).to have_title “my_title” According to github.com/jnicklas/capybara/issues/863 the following is also working with capybara 2.0: expect(first(‘title’).native.text).to eq “my title”

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)