Posted over 7 years ago. Visible to the public. Linked content.

Hack-fix Selenium::WebDriver::Element#select is deprecated

In some older Capybara versions (e.g. 0.3.9), we're getting lots of deprecations warnings:

Selenium::WebDriver::Element#select is deprecated. Please use Selenium::WebDriver::Element#click and determine the current state with Selenium::WebDriver::Element#selected?

Hani-elabed on Github helps. Add this code to features/support/env.rb to remove them temporarily:

# June 30th, 2011 # a temporary hack to disable the annoying upstream warnings capybara > selenium-webdriver 0.2.2 # capybara folks know about this and are working on it. See: # # Remove this whole block when Capybara 1.0.1 or greater are used module Selenium module WebDriver class Element # # Select this element # def select #warn "#{self.class}#select is deprecated. Please use #{self.class}#click and determine the current state with #{self.class}#selected?" unless displayed? raise Error::ElementNotDisplayedError, "you may not select an element that is not displayed" end unless enabled? raise Error::InvalidElementStateError, "cannot select a disabled element" end unless selectable? raise Error::InvalidElementStateError, "you may only select options, radios or checkboxes" end click unless selected? end end end end

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Dominik Schöler
Last edit:
over 7 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more