lib/capybara/poltergeist/browser.rb in poltergeist-1.16.0 vs lib/capybara/poltergeist/browser.rb in poltergeist-1.17.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require "capybara/poltergeist/errors"
require "capybara/poltergeist/command"
require 'json'
require 'time'
@@ -9,10 +11,11 @@
'Poltergeist.JavascriptError' => JavascriptError,
'Poltergeist.FrameNotFound' => FrameNotFound,
'Poltergeist.InvalidSelector' => InvalidSelector,
'Poltergeist.StatusFailError' => StatusFailError,
'Poltergeist.NoSuchWindowError' => NoSuchWindowError,
+ 'Poltergeist.ScriptTimeoutError' => ScriptTimeoutError,
'Poltergeist.UnsupportedFeature' => UnsupportedFeature,
'Poltergeist.KeyError' => KeyError,
}
attr_reader :server, :client, :logger
@@ -123,10 +126,14 @@
def evaluate(script, *args)
command 'evaluate', script, *args
end
+ def evaluate_async(script, wait_time, *args)
+ command 'evaluate_async', script, wait_time, *args
+ end
+
def execute(script, *args)
command 'execute', script, *args
end
def within_frame(handle, &block)
@@ -139,10 +146,10 @@
yield
ensure
command 'pop_frame'
end
- def switch_to_frame(handle, &block)
+ def switch_to_frame(handle)
case handle
when Capybara::Node::Base
command 'push_frame', [handle.native.page_id, handle.native.id]
when :parent
command 'pop_frame'