class Capybara::Apparition::ChromeClient::Response
Public Class Methods
new(client, *msg_ids, send_time: nil)
click to toggle source
# File lib/capybara/apparition/driver/response.rb, line 6 def initialize(client, *msg_ids, send_time: nil) @send_time = send_time @msg_ids = msg_ids @client = client end
Public Instance Methods
[](key)
click to toggle source
# File lib/capybara/apparition/driver/response.rb, line 29 def [](key) result[key] end
discard_result()
click to toggle source
# File lib/capybara/apparition/driver/response.rb, line 23 def discard_result @msg_ids.each { |id| @client.add_async_id id } @result_time = Time.now nil end
result()
click to toggle source
# File lib/capybara/apparition/driver/response.rb, line 12 def result response = @msg_ids.map do |id| resp = @client.send(:wait_for_msg_response, id) handle_error(resp['error']) if resp['error'] resp end.last puts "Processed msg: #{@msg_ids.last} in #{Time.now - @send_time} seconds" if ENV['DEBUG'] == 'V' response['result'] end
Private Instance Methods
handle_error(error)
click to toggle source
# File lib/capybara/apparition/driver/response.rb, line 35 def handle_error(error) case error['code'] when -32_000 raise WrongWorld.new(nil, error) else raise CDPError.new(error) end end