Class: Selenium::WebDriver::Safari::Bridge

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

Constant Summary collapse

COMMAND_TIMEOUT =
60

Constants inherited from Remote::Bridge

Remote::Bridge::QUIT_ERRORS

Instance Attribute Summary

Attributes inherited from Remote::Bridge

#capabilities, #context, #file_detector, #http

Instance Method Summary collapse

Methods inherited from Remote::Bridge

#acceptAlert, #addCookie, #browser, #clearElement, #clearLocalStorage, #clearSessionStorage, #click, #clickElement, #close, command, #contextClick, #deleteAllCookies, #deleteCookie, #dismissAlert, #doubleClick, #dragElement, #elementEquals, #executeAsyncScript, #executeScript, #find_element_by, #find_elements_by, #get, #getActiveElement, #getAlert, #getAlertText, #getAllCookies, #getAvailableLogTypes, #getCapabilities, #getCurrentUrl, #getCurrentWindowHandle, #getElementAttribute, #getElementLocation, #getElementLocationOnceScrolledIntoView, #getElementSize, #getElementTagName, #getElementText, #getElementValue, #getElementValueOfCssProperty, #getLocalStorageItem, #getLocalStorageKeys, #getLocalStorageSize, #getLocation, #getLog, #getPageSource, #getScreenshot, #getSessionStorageItem, #getSessionStorageKeys, #getSessionStorageSize, #getTitle, #getVisible, #getWindowHandles, #getWindowPosition, #getWindowSize, #goBack, #goForward, #isBrowserOnline, #isElementDisplayed, #isElementEnabled, #isElementSelected, #maximizeWindow, #mouseDown, #mouseMoveTo, #mouseUp, #refresh, #removeLocalStorageItem, #removeSessionStorageItem, #sendKeysToActiveElement, #sendKeysToElement, #session_id, #setAlertValue, #setBrowserOnline, #setImplicitWaitTimeout, #setLocalStorageItem, #setLocation, #setScriptTimeout, #setSessionStorageItem, #setTimeout, #setVisible, #setWindowPosition, #setWindowSize, #submitElement, #switchToDefaultContent, #switchToFrame, #switchToWindow, #touchDoubleTap, #touchDown, #touchElementFlick, #touchFlick, #touchLongPress, #touchMove, #touchScroll, #touchSingleTap, #touchUp, #upload

Methods included from BridgeHelper

#element_id_from, #parse_cookie_string, #unwrap_script_result

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
# File 'lib/selenium/webdriver/safari/bridge.rb', line 8

def initialize(opts = {})
  port              = Integer(opts[:port] || PortProber.random)
  timeout           = Integer(opts[:timeout] || COMMAND_TIMEOUT)
  custom_data_dir   = opts[:custom_data_dir]
  install_extension = opts.fetch(:install_extension) { true }

  @command_id ||= 0

  if install_extension
    @extension = Extension.new(:custom_data_dir => custom_data_dir)
    @extension.install
  end

  @server = Server.new(port, timeout)
  @server.start

  @safari = Browser.new
  @safari.start(prepare_connect_file)

  @server.wait_for_connection

  super(:desired_capabilities => :safari)
end

Instance Method Details

#driver_extensionsObject



40
41
42
# File 'lib/selenium/webdriver/safari/bridge.rb', line 40

def driver_extensions
  []
end

#quitObject



32
33
34
35
36
37
38
# File 'lib/selenium/webdriver/safari/bridge.rb', line 32

def quit
  super

  @server.stop
  @safari.stop
  @extension && @extension.uninstall
end