24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/proxy_rb/drivers/poltergeist_driver.rb', line 24
def register(proxy)
if proxy.empty?
::Capybara.current_driver = :poltergeist
return
end
cli_parameters = []
cli_parameters << "--proxy=#{proxy.url}" unless proxy.url.empty?
cli_parameters << "--proxy-auth=#{proxy.credentials}" unless proxy.credentials.empty?
options = {
phantomjs_options: cli_parameters,
js_errors: false,
phantomjs_logger: $stderr
}
unless ::Capybara.drivers.key? proxy.to_ref
::Capybara.register_driver proxy.to_ref do |app|
::Capybara::Poltergeist::Driver.new(app, options)
end
end
::Capybara.current_driver = proxy.to_ref
end
|