Sławosz
Sławosz

Reputation: 11687

Capybara within is extremly slow when updated from to

I have such method:

def self.click_button(label)
  selector = "menu.toolbar"
  page.within(selector) do
    page.click_link(label)
  end
end

On capybara 1.1.2 (ancient) it works fine, in modern version 2.5.0, it is very slow - takes like 10 minutes to return empty element.

When I pause with debugger just before within I can find element without any issues with jQuery on JS console. I am using chrome to run tests.

Upvotes: 0

Views: 637

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49890

Capybara 2.5.0 is also ancient, being that it was released August 26, 2015. I would recommend upgrading to the latest release (2.12.1 as of now).

within will wait up to Capybara.default_max_wait_time seconds for a matching visible element to be found, and if not found will then raise an exception. If you're saying it takes 10 minutes to do that then you need to reduce whatever you have set Capybara.default_max_wait_time to.

Upvotes: 3

Related Questions