Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
spec: ensure the driver is quit properly
  • Loading branch information
meh committed Jan 25, 2014
1 parent 8d5d045 commit 7985d44
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions spec/runner.rb
Expand Up @@ -39,10 +39,6 @@
browser = Selenium::WebDriver.for(:remote, url: url, desired_capabilities: cap)
browser.navigate.to('http://localhost:9292')

at_exit {
browser.quit
}

begin
Selenium::WebDriver::Wait.new(timeout: 540, interval: 5) \
.until { not browser.find_element(:css, 'p#totals').text.strip.empty? }
Expand Down Expand Up @@ -85,16 +81,12 @@
}
}
rescue Selenium::WebDriver::Error::NoSuchElementError
puts 'ya blew it'
puts browser.page_source
end
rescue Selenium::WebDriver::Error::TimeOutError
trials += 1

unless trials >= 4
ensure
browser.quit
retry
end
rescue Selenium::WebDriver::Error::TimeOutError
retry unless (trials += 1) >= 4
end

exit 1

0 comments on commit 7985d44

Please sign in to comment.