Class: Selenium::WebDriver::Firefox::Bridge

Inherits:
Remote::Bridge show all
Defined in:
lib/selenium/webdriver/firefox/bridge.rb

Constant Summary

Constants inherited from Remote::Bridge

Remote::Bridge::QUIT_ERRORS

Constants included from Selenium::WebDriver::Find

Selenium::WebDriver::Find::FINDERS

Instance Attribute Summary

Attributes inherited from Remote::Bridge

#capabilities, #context, #http

Instance Method Summary collapse

Methods inherited from Remote::Bridge

#addCookie, #clearElement, #clickElement, #close, command, #create_session, #deleteAllCookies, #deleteCookie, #dragElement, #elementEquals, #executeScript, #findElementByClassName, #findElementByCssSelector, #findElementById, #findElementByLinkText, #findElementByName, #findElementByPartialLinkText, #findElementByTagName, #findElementByXpath, #findElementsByClassName, #findElementsByCssSelector, #findElementsById, #findElementsByLinkText, #findElementsByName, #findElementsByPartialLinkText, #findElementsByTagName, #findElementsByXpath, #get, #getActiveElement, #getAllCookies, #getCapabilities, #getCurrentUrl, #getCurrentWindowHandle, #getElementAttribute, #getElementLocation, #getElementSize, #getElementTagName, #getElementText, #getElementValue, #getElementValueOfCssProperty, #getPageSource, #getSpeed, #getTitle, #getVisible, #getWindowHandles, #goBack, #goForward, #hoverOverElement, #isElementDisplayed, #isElementEnabled, #isElementSelected, #refresh, #sendKeysToElement, #session_id, #setElementSelected, #setImplicitWaitTimeout, #setSpeed, #setVisible, #submitElement, #switchToDefaultContent, #switchToFrame, #switchToWindow, #toggleElement

Methods included from BridgeHelper

#element_id_from, #parse_cookie_string, #unwrap_script_result

Methods included from Selenium::WebDriver::Find

#find_element, #find_elements

Constructor Details

#initialize(opts = {}) ⇒ Bridge

Returns a new instance of Bridge.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/selenium/webdriver/firefox/bridge.rb', line 8

def initialize(opts = {})
  @binary     = Binary.new
  @launcher   = Launcher.new(
    @binary,
    opts.delete(:port) || DEFAULT_PORT,
    opts.delete(:profile)
  )

  http_client = opts.delete(:http_client)

  unless opts.empty?
    raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
  end

  @launcher.launch

  remote_opts = {
    :url                  => @launcher.url,
    :desired_capabilities => :firefox
  }

  remote_opts.merge!(:http_client => http_client) if http_client

  super(remote_opts)
end

Instance Method Details

#browserObject



34
35
36
# File 'lib/selenium/webdriver/firefox/bridge.rb', line 34

def browser
  :firefox
end

#driver_extensionsObject



38
39
40
# File 'lib/selenium/webdriver/firefox/bridge.rb', line 38

def driver_extensions
  [DriverExtensions::TakesScreenshot]
end

#getScreenshotObject



49
50
51
# File 'lib/selenium/webdriver/firefox/bridge.rb', line 49

def getScreenshot
  execute :screenshot
end

#quitObject



42
43
44
45
46
47
# File 'lib/selenium/webdriver/firefox/bridge.rb', line 42

def quit
  super
  @binary.quit

  nil
end