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, #getNetworkConnection, #getPageSource, #getScreenOrientation, #getScreenshot, #getSessionStorageItem, #getSessionStorageKeys, #getSessionStorageSize, #getTitle, #getVisible, #getWindowHandles, #getWindowPosition, #getWindowSize, #goBack, #goForward, #isElementDisplayed, #isElementEnabled, #isElementSelected, #maximizeWindow, #mouseDown, #mouseMoveTo, #mouseUp, #refresh, #removeLocalStorageItem, #removeSessionStorageItem, #sendKeysToActiveElement, #sendKeysToElement, #session_id, #setAlertValue, #setImplicitWaitTimeout, #setLocalStorageItem, #setLocation, #setNetworkConnection, #setScreenOrientation, #setScriptTimeout, #setSessionStorageItem, #setTimeout, #setVisible, #setWindowPosition, #setWindowSize, #status, #submitElement, #switchToDefaultContent, #switchToFrame, #switchToParentFrame, #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.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/selenium/webdriver/safari/bridge.rb', line 27

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

  # 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



53
54
55
56
57
58
# File 'lib/selenium/webdriver/safari/bridge.rb', line 53

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

#quitObject



46
47
48
49
50
51
# File 'lib/selenium/webdriver/safari/bridge.rb', line 46

def quit
  super

  @server.stop
  @safari.stop
end