Class: Selenium::WebDriver::Chrome::Bridge

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

Constant Summary

Constants inherited from Remote::Bridge

Remote::Bridge::QUIT_ERRORS

Constants included from Find

Find::FINDERS

Instance Attribute Summary

Attributes inherited from Remote::Bridge

#context, #http

Instance Method Summary collapse

Methods inherited from Remote::Bridge

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

Methods included from BridgeHelper

#element_id_from, #parse_cookie_string, #unwrap_script_result

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

def initialize(opts = {})
  @launcher = Launcher.launcher(
    :default_profile => opts[:default_profile],
    :secure_ssl      => opts[:secure_ssl]
  )

  @executor = CommandExecutor.new
  @launcher.launch(@executor.uri)
end

Instance Method Details

#browserObject



18
19
20
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 18

def browser
  :chrome
end

#capabilitiesObject



26
27
28
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 26

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

#deleteCookie(name) ⇒ Object



64
65
66
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 64

def deleteCookie(name)
  execute :deleteCookie, :name => name
end

#driver_extensionsObject



22
23
24
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 22

def driver_extensions
  [DriverExtensions::TakesScreenshot]
end

#elementEquals(element, other) ⇒ Object



72
73
74
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 72

def elementEquals(element, other)
  element.ref == other.ref
end

#findElementByCssSelector(parent, selector) ⇒ Object



52
53
54
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 52

def findElementByCssSelector(parent, selector)
  find_element_by 'css', selector, parent
end

#findElementsByCssSelector(parent, selector) ⇒ Object



56
57
58
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 56

def findElementsByCssSelector(parent, selector)
  find_elements_by 'css', selector, parent
end

#getAllCookiesObject



60
61
62
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 60

def getAllCookies
  execute :getCookies
end

#getScreenshotObject



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

def getScreenshot
  execute :screenshot
end

#getSpeedObject



48
49
50
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 48

def getSpeed
  @speed
end

#quitObject



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

def quit
  begin
    super
  rescue IOError
  end

  @executor.close
  @launcher.quit
end

#setImplicitWaitTimeout(milliseconds) ⇒ Object



68
69
70
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 68

def setImplicitWaitTimeout(milliseconds)
  execute :implicitlyWait, :ms => milliseconds
end

#setSpeed(value) ⇒ Object



44
45
46
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 44

def setSpeed(value)
  @speed = value
end