3

I made a function called wait_for_page load, and I am trying to set the default_wait_time to this function.

I get an undefined variable error:

undefined local variable or method `page' for main:Object (NameError)

I also included the file into the main environment file:

require File.expand_path('../../support/file_name.rb', FILE)

Adi Inbar
  • 12,097
  • 13
  • 56
  • 69
tSebastian
  • 79
  • 2
  • 8

1 Answers1

7

default_wait_time is an accessor in Capybara module. So you'll need to call it on the Capybara object itself, like:

Capybara.default_wait_time = some_value

And Capybara object should be available wherever you have defined this method.

In some newer versions accessor is default_max_wait_time, you can notice this because of a DEPRECATION warning So you need to do this:

Capybara.default_max_wait_time = 5

The default is 2 seconds

G. I. Joe
  • 1,585
  • 17
  • 21
Sam
  • 884
  • 6
  • 15