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, #getScreenOrientation, #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, #setScreenOrientation, #setScriptTimeout, #setSessionStorageItem, #setTimeout, #setVisible, #setWindowPosition, #setWindowSize, #status, #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
# File 'lib/selenium/webdriver/safari/bridge.rb', line 8

def initialize(opts = {})
  command_timeout = Integer(opts[:timeout] || COMMAND_TIMEOUT)
  safari_options  = opts.delete(:options) || Safari::Options.new(opts)
  capabilities    = merge_capabilities(opts, safari_options)

  @command_id ||= 0

  @extensions = Extensions.new(safari_options)
  @extensions.install

  # TODO: handle safari_opts['cleanSession']
  @server = Server.new(safari_options.port, command_timeout)
  @server.start

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

  @server.wait_for_connection

  super(desired_capabilities: capabilities)
end

Instance Method Details

#driver_extensionsObject



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

def driver_extensions
  [
    DriverExtensions::TakesScreenshot,
    DriverExtensions::HasInputDevices
  ]
end

#quitObject



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

def quit
  super

  @server.stop
  @safari.stop
  @extensions.uninstall
end