Class: Selenium::WebDriver::PhantomJS::Bridge Private

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

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.

Constant Summary

Constants inherited from Remote::Bridge

Remote::Bridge::QUIT_ERRORS

Instance Attribute Summary

Attributes inherited from Remote::Bridge

#context, #file_detector, #http

Instance Method Summary collapse

Methods inherited from Remote::Bridge

#acceptAlert, #addCookie, #clearElement, #clearLocalStorage, #clearSessionStorage, #click, #clickElement, #close, command, #contextClick, #create_session, #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

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 Bridge.



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

def initialize(opts = {})
  http_client = opts.delete(:http_client)
  caps        = opts.delete(:desired_capabilities) { Remote::Capabilities.phantomjs }

  if opts.has_key?(:url)
    url = opts.delete(:url)
  else
    args = opts.delete(:args) || caps['phantomjs.cli.args']
    port = opts.delete(:port)

    @service = Service.default_service(port)
    @service.start(args)

    url = @service.uri
  end

  remote_opts = {
    :url                  => url,
    :desired_capabilities => caps
  }

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

  super(remote_opts)
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.



35
36
37
# File 'lib/selenium/webdriver/phantomjs/bridge.rb', line 35

def browser
  :phantomjs
end

#capabilitiesObject

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.



46
47
48
# File 'lib/selenium/webdriver/phantomjs/bridge.rb', line 46

def capabilities
  @capabilities ||= Remote::Capabilities.phantomjs
end

#driver_extensionsObject

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.



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

def driver_extensions
  [
    DriverExtensions::TakesScreenshot,
    DriverExtensions::HasInputDevices
  ]
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.



50
51
52
53
54
# File 'lib/selenium/webdriver/phantomjs/bridge.rb', line 50

def quit
  super
ensure
  @service.stop if @service
end