Module: Crabfarm::Support::WebdriverFactory
- Extended by:
- WebdriverFactory
- Included in:
- WebdriverFactory
- Defined in:
- lib/crabfarm/support/webdriver_factory.rb
Instance Method Summary collapse
- #build_chrome_driver(_options = {}) ⇒ Object
- #build_firefox_driver(_options = {}) ⇒ Object
- #build_remote_driver(_options = {}) ⇒ Object
Instance Method Details
#build_chrome_driver(_options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/crabfarm/support/webdriver_factory.rb', line 8 def build_chrome_driver(={}) switches = [] if [:proxy].present? switches << "--proxy-server=#{[:proxy]}" switches << "--ignore-certificate-errors" end common_setup Selenium::WebDriver.for(:chrome, :switches => switches), end |
#build_firefox_driver(_options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/crabfarm/support/webdriver_factory.rb', line 19 def build_firefox_driver(={}) profile = Selenium::WebDriver::Firefox::Profile.new if [:proxy].present? profile.proxy = Selenium::WebDriver::Proxy.new({ :http => [:proxy], :ssl => [:proxy] }) end common_setup Selenium::WebDriver.for(:firefox, :profile => profile), end |
#build_remote_driver(_options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/crabfarm/support/webdriver_factory.rb', line 32 def build_remote_driver(={}) client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = [:remote_timeout] if [:proxy].present? client.proxy = Selenium::WebDriver::Proxy.new({ :http => [:proxy], :ssl => [:proxy] }) end common_setup(Selenium::WebDriver.for(:remote, { :url => [:remote_host], :http_client => client, :desired_capabilities => [:capabilities] || Selenium::WebDriver::Remote::Capabilities.firefox }), ) end |