Method: Quke::DriverConfiguration#firefox
- Defined in:
- lib/quke/driver_configuration.rb
#firefox ⇒ Object
Returns an instance of Selenium::WebDriver::Remote::Capabilities to be used when registering an instance of Capybara::Selenium::Driver, configured to run using Firefox (the default).
For example when initialising the driver like this
my_profile = Selenium::WebDriver::Firefox::Profile.new
my_profile.proxy = Selenium::WebDriver::Proxy.new(
http: "10.10.2.70:8080",
ssl: "10.10.2.70:8080"
)
my_profile['general.useragent.override'] = "Mozilla/5.0 (MSIE 10.0; Windows NT 6.1; Trident/5.0)"
::Selenium::Driver.new(
app,
profile: my_profile
)
You can instead call Quke::DriverConfiguration.firefox which will manage instantiating and setting up the Selenium::WebDriver::Firefox::Profile instance based on the properties of the Quke::Configuration instance its initialised with
::Selenium::Driver.new(
app,
profile: my_driver_config.firefox
)
rubocop:disable Metrics/AbcSize
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/quke/driver_configuration.rb', line 188 def firefox profile = Selenium::WebDriver::Firefox::Profile.new settings = {} settings[:http] = "#{config.proxy['host']}:#{config.proxy['port']}" if config.use_proxy? settings[:ssl] = settings[:http] if config.use_proxy? settings[:no_proxy] = config.proxy['no_proxy'] unless config.proxy['no_proxy'].empty? profile.proxy = Selenium::WebDriver::Proxy.new(settings) if config.use_proxy? profile['general.useragent.override'] = config.user_agent unless config.user_agent.empty? profile end |