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

def initialize(opts = {})
  @executor = CommandExecutor.new

  @launcher = Launcher.launcher(:default_profile => opts[:default_profile])
  @launcher.launch(@executor.uri)
end

Instance Method Details

#browserObject



15
16
17
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 15

def browser
  :chrome
end

#capabilitiesObject



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

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

#deleteCookie(name) ⇒ Object



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

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

#driver_extensionsObject



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

def driver_extensions
  [DriverExtensions::TakesScreenshot]
end

#findElementByCssSelector(parent, selector) ⇒ Object



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

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

#findElementsByCssSelector(parent, selector) ⇒ Object



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

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

#getAllCookiesObject



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

def getAllCookies
  execute :getCookies
end

#getScreenshotObject



37
38
39
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 37

def getScreenshot
  execute :screenshot
end

#getSpeedObject



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

def getSpeed
  @speed
end

#quitObject



27
28
29
30
31
32
33
34
35
# File 'lib/selenium/webdriver/chrome/bridge.rb', line 27

def quit
  begin
    super
  rescue IOError
  end

  @executor.close
  @launcher.quit
end

#setImplicitWaitTimeout(milliseconds) ⇒ Object



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

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

#setSpeed(value) ⇒ Object



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

def setSpeed(value)
  @speed = value
end