Sha256: f9e406a29462c47b99d5821a38c5e68ffa98e3f2b280842cb77ce59f05ea7e88
Contents?: true
Size: 1.12 KB
Versions: 20
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true require 'proxy_rb/drivers/basic_driver' require 'capybara' require 'selenium-webdriver' require 'proxy_rb/errors' # ProxyRb module ProxyRb # Drivers module Drivers # Driver for Selenium class SeleniumDriver < BasicDriver # Register proxy # # @param [HttpProxy] proxy # The HTTP proxy which should be used for fetching content def register(proxy) if proxy.empty? ::Capybara.current_driver = :selenium return end profile = Selenium::WebDriver::Firefox::Profile.new # profile.proxy = Selenium::WebDriver::Proxy.new(http: proxy.full_url) profile.proxy = Selenium::WebDriver::Proxy.new(http: format('%s:%s', proxy.host, proxy.port)) unless ::Capybara.drivers.key? proxy.to_ref ::Capybara.register_driver proxy.to_ref do |app| ::Capybara::Selenium::Driver.new(app, profile: profile) end end ::Capybara.current_driver = proxy.to_ref end def timeout_errors [] end def failure_errors [] end end end end
Version data entries
20 entries across 20 versions & 1 rubygems