-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to specify a proxy for each driver #46
Comments
Have found some examples of how to do this http://stackoverflow.com/a/6595850/6117745 Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile["network.proxy.type"] = 1 # manual proxy config
profile["network.proxy.http"] = "http://example.com"
profile["network.proxy.http_port"] = 80
Capybara::Selenium::Driver.new(app, :profile => profile)
end https://gist.github.com/antonyh/5338945b37b6b52a98f5 Capybara.register_driver :poltergeist_proxy do |app|
options = {
phantomjs_options: [
'--ignore-ssl-errors=yes',
"--proxy=#{CapybaraProxy.proxy.host}:#{CapybaraProxy.proxy.port}"
]
}
Capybara::Poltergeist::Driver.new(app, options)
end
Capybara.register_driver :webkit_proxy do |app|
driver = Capybara::Driver::Webkit.new(app)
driver.browser.set_proxy(:host => CapybaraProxy.proxy.host,
:port => CapybaraProxy.proxy.port)
driver.browser.ignore_ssl_errors
driver
end
Capybara.register_driver :selenium_proxy do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new(
:http => "#{CapybaraProxy.proxy.host}:#{CapybaraProxy.proxy.port}",
:ssl => "#{CapybaraProxy.proxy.host}:#{CapybaraProxy.proxy.port}")
Capybara::Selenium::Driver.new(app, :profile => profile)
end profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.http'] = 'localhost'
profile['network.proxy.http_port'] = 9090
driver = Selenium::WebDriver.for :firefox, :profile => profile |
This change adds support to **Quke** to specify a proxy server when using the **PhantomJS** and **Selenium** based drivers (in **Quke's case *chrome* and *firefox*). The reasoning is that connection to the internet may be been setup to go via a proxy server for security purposes in some build environments. With no way currently to tell **Quke** this is means it cannot be used if this is the case. This new feature relates to issue #46.
For future reference when it comes to figuring out what options you can pass to chrome it essentially appears to be this list http://peter.sh/experiments/chromium-command-line-switches You can pass them in as an array with the switches tag for example Capybara::Selenium::Driver.new(
app,
browser: :chrome,
switches: ["--proxy-server=localhost:8080"]
) Got this inspiration when I found this https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings#chrome |
This was resolved #47 |
We have found that in some build environments access to the internet is provided by a proxy. Therefore for Quke to work we need to be able to tell PhantomJS and Selenium what the address and port for the proxy server is.
The text was updated successfully, but these errors were encountered: