Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CapybaraExtensions: select_then_close to close dropdown that obscures submit button #112

Open
eliotsykes opened this issue Jan 19, 2016 · 0 comments

Comments

@eliotsykes
Copy link
Owner

File: spec/support/capybara_extensions.rb

module CapybaraExtensions

  # Selects option from <select> drop down then closes the drop down.
  # Useful when a drop down obscures an element that needs to be clicked.
  def select_then_close(value, options = {})
    select(value, options)
    press_tab_key
  end

  def press_tab_key
    find('body').send_keys :tab
  end
end

RSpec.configure do |config|
  config.include CapybaraExtensions, type: :feature
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant