Class: Selenium::WebDriver::Firefox::Legacy::Driver Private

Inherits:
Driver
  • Object
show all
Includes:
DriverExtensions::TakesScreenshot
Defined in:
lib/selenium/webdriver/firefox/legacy/driver.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Driver implementation for Firefox using legacy extension.

API:

  • private

Constant Summary

Constants included from SearchContext

SearchContext::FINDERS

Instance Method Summary collapse

Methods included from DriverExtensions::TakesScreenshot

#save_screenshot, #screenshot_as

Methods inherited from Driver

#[], #action, #capabilities, #close, #current_url, #execute_async_script, #execute_script, for, #get, #inspect, #keyboard, #manage, #mouse, #navigate, #page_source, #ref, #switch_to, #title, #window_handle, #window_handles

Methods included from SearchContext

#find_element, #find_elements

Constructor Details

#initialize(opts = {}) ⇒ Driver

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Driver.

API:

  • private



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/selenium/webdriver/firefox/legacy/driver.rb', line 31

def initialize(opts = {})
  opts[:desired_capabilities] ||= Remote::Capabilities.firefox

  if opts.key? :proxy
    WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
    opts[:desired_capabilities].proxy = opts.delete(:proxy)
  end

  unless opts.key?(:url)
    port = opts.delete(:port) || DEFAULT_PORT
    profile = opts.delete(:profile)

    Binary.path = opts[:desired_capabilities][:firefox_binary] if opts[:desired_capabilities][:firefox_binary]
    @launcher = Launcher.new Binary.new, port, profile
    @launcher.launch
    opts[:url] = @launcher.url
  end

  listener = opts.delete(:listener)
  WebDriver.logger.info 'Skipping handshake as we know it is OSS.'
  desired_capabilities = opts.delete(:desired_capabilities)
  bridge = Remote::Bridge.new(opts)
  capabilities = bridge.create_session(desired_capabilities)
  @bridge = Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)

  begin
    super(@bridge, listener: listener)
  rescue
    @launcher.quit if @launcher
    raise
  end
end

Instance Method Details

#browserObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



64
65
66
# File 'lib/selenium/webdriver/firefox/legacy/driver.rb', line 64

def browser
  :firefox
end

#quitObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



68
69
70
71
72
73
# File 'lib/selenium/webdriver/firefox/legacy/driver.rb', line 68

def quit
  super
  nil
ensure
  @launcher.quit
end