module Symbiont module Evaluators def visit(url) platform.visit(url) end def text platform.text end def markup platform.markup end alias_method :html, :markup def title platform.title end def url platform.url end # Save a snapshot of the current screen to a provided file location. # The file will be saved as a PNG file in the path specified or in the # location where the tests are being run from. def screenshot(file) platform.screenshot file end def focus platform.focus end alias_method :what_has_focus?, :focus # Executes JavaScript against the browser instance. def run_script(script) platform.run_script(script) end alias_method :execute_script, :run_script def back platform.back end # Provides an evaluator that attempts to wait for any pending AJAX # requests from the jQuery library. def wait_for_pending_requests(time_limit=30, message_if_timeout=nil) end_time = ::Time.now + time_limit until ::Time.now > end_time begin return if browser.execute_script('return jQuery.active') == 0 rescue ReferenceError end sleep 0.5 end message = "Pending jQuery requests never indicated completion." unless message_if_timeout raise message end end # module: Evaluators end # module: Symbiont