Module: EDSL::PageObject::AJAX
Instance Method Summary collapse
-
#wait_for_ajax(timeout = 30, message = nil) ⇒ Object
Wait until there are no pending ajax requests.
Instance Method Details
#wait_for_ajax(timeout = 30, message = nil) ⇒ Object
Wait until there are no pending ajax requests. This requires you to set the javascript framework in advance.
the timeout duration.
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/edsl/page_object/ajax_support.rb', line 89 def wait_for_ajax(timeout = 30, = nil) end_time = ::Time.now + timeout until ::Time.now > end_time begin return if browser.execute_script(::EDSL::PageObject::JavascriptFrameworkFacade.pending_requests) == 0 rescue Selenium::WebDriver::Error::UnknownError, Selenium::WebDriver::Error::JavascriptError end sleep 0.5 end = "Timed out waiting for ajax requests to complete" unless raise end |