Question

on the website that I am testing, the following happens:

  • you click a button
  • an ajax-call is executed, all input fields are temporarily disabled
  • once the data is retrieved, the fields are filled in and no longer disabled

To wait for this to happen (no sleep or other stupid solutions), I was thinking about something like this:

find('order-button', :disabled => false).click

But I get the following Exception: ArgumentError: invalid keys :disabled, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait

How do I get this to work? I am using the latest version of Capybara (2.1.0)

Any input in this is highly appreciated :)

Was it helpful?

Solution

:disabled option is supported only by following selector types:

:field
:link_or_button
:button
:fillable_field
:radio_button
:checkbox
:select
:file_field

It can be used as:

find(:field, 'field_id', disabled: false)

This option is not supported by :css that you seem to use.

With :css you are expected to use css's attributes which is much shorter:

find('#field_id:not([disabled])')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top