Skip to content

Instantly share code, notes, and snippets.

@jimmyeisenhauer
Created September 16, 2014 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyeisenhauer/a61f52ef2836c8309e2c to your computer and use it in GitHub Desktop.
Save jimmyeisenhauer/a61f52ef2836c8309e2c to your computer and use it in GitHub Desktop.
def create_button
@driver.find_element(:link, 'Create')
end
def create_button_click
@wait = Selenium::WebDriver::Wait.new(timeout: 8)
puts 'DEBUG: Clicking Create Button'
create_button.click
puts 'DEBUG: Waiting for View This Challenge'
@wait.until { @driver.find_element(:link, 'view this challenge') }
puts 'DEBUG: Found view challenge link'
rescue
puts 'DEBUG: Rescue: Clicking Create Button'
create_button.click
@wait.until { @driver.find_element(:link, 'view this challenge') }
puts 'DEBUG: Found view challenge link'
end
@jimmyeisenhauer
Copy link
Author

Yeah there is something weird going on with my waits. I had the same problem with wait not set as a instance var as well. I moved to a instance var to aid in some trouble shooting.

The implicit wait i moved to 30 seconds and I still see the explicit one at 60 seconds, which is prob http like you stated.
@driver.manage.timeouts.implicit_wait = 30

I added
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120 # seconds

as a work around it just takes a while :-)

The rescue is there to attempt the click again if the first one fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment