How to click on the second link with the same text using Capybara in Rails 3?
You could try to find all entries and deal with an array: page.all(‘a’)[1].click Would help to have a class or use within to scope your search 😉
You could try to find all entries and deal with an array: page.all(‘a’)[1].click Would help to have a class or use within to scope your search 😉
It appears that Capybara’s handling of disabled elements has changed, so I figured I’d give an update. To test whether a page has a button and is enabled, use: expect(page).to have_button(‘Save’) To test whether a page has a button and is disabled, use: expect(page).to have_button(‘Save’, disabled: true) This format works with has_field?, find_field, etc. You … Read more
You can call HTML DOM innerHTML Property: find(‘//tr[2]//td[7]’)[‘innerHTML’] Should work for any browser or driver. You can check all available properties on w3schools
Your missing route looks like some auto-generated assets path with nil input. Are you sure your assets are correctly specified in your css/sass or wherever this route comes from? I have been struggling with a similiar issue where an asset path induced a routing error 1) user signup: [ JS ] : creates User on … Read more
This feature was added to Capybara on April 25th, 2011 with this commit – https://github.com/jnicklas/capybara/commit/a00435d63085ac2e74a0f64e7b7dedc0f7252ea9 You can can now specify a custom header when using a custom Capybara driver. See http://automagical.posterous.com/creating-a-custom-capybara-driver for code examples.
You can interact with hidden elements using the visible: false property in Capybara. If you want to click on hidden element use: find(“#photos”, visible: false).click Don’t use click_button(‘#photo’) directly
Then show me the page calls webrat/capybara’s underlying save_and_open_page method. Found that useful when working with steak.
You are getting the user and collecting it to new variable @user but while you are calling the sign_in method again you did initialize the new variable user with using(eg. @user)
You can click on an element via Capybara::Element.click. I add the following for this in my web_steps.rb to click on divs. When /^(?:|I )click within “([^”]*)”$/ do |selector| find(selector).click end There is also Element.trigger(‘mouseover’) which appears to enable hover albeit not working with Selenium. It is also very likely you will need to decorate your … Read more
You can click on an alert box like this: page.driver.browser.switch_to.alert.accept