Read more

Upgrading Capybara with deprecated Integer selectors

Emanuel
June 08, 2021Software engineer at makandra GmbH

Capybara added a deprecation warning in version 3.35.3 (version from 2019) that shows up if your selector is not of type String or Symbol.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Example:

click_link(10) # bad
click_link("10") # good

You might encounter this error e.g. in a pagination step or similar where you want to click on numbers. To figure out where this deprecation warning comes from try to run the tests with a step output.

bundle exec parallel_cucumber --test-options "--format=pretty" feature

The deprecation message looks like following:

Locator Integer:2 for selector :link must be an instance of String or Symbol
Locator Integer:3 for selector :link must be an instance of String or Symbol
Posted by Emanuel to makandra dev (2021-06-08 08:39)