Class: Selenium::WebDriver::Remote::W3CBridge Private

Inherits:
Object
  • Object
show all
Includes:
BridgeHelper
Defined in:
lib/selenium/webdriver/remote/w3c_bridge.rb,
lib/selenium/webdriver/remote/w3c_commands.rb

Overview

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.

Licensed to the Software Freedom Conservancy (SFC) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The SFC licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Direct Known Subclasses

Edge::Bridge, Firefox::W3CBridge

Constant Summary collapse

COMMANDS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{}
QUIT_ERRORS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[IOError]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BridgeHelper

#element_id_from, #parse_cookie_string, #unwrap_script_result

Constructor Details

#initialize(opts = {}) ⇒ W3CBridge

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.

Initializes the bridge with the given server URL.

Parameters:

  • url (String)

    url for the remote server

  • http_client (Object)

    an HTTP client instance that implements the same protocol as Http::Default

  • desired_capabilities (Capabilities)

    an instance of Remote::Capabilities describing the capabilities you want



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 64

def initialize(opts = {})
  if opts.fetch(:desired_capabilities, {})[:browser_name] == 'MicrosoftEdge'
    require_relative '../edge/legacy_support'
    extend Edge::LegacySupport
  end

  opts = opts.dup

  http_client          = opts.delete(:http_client) { Http::Default.new }
  desired_capabilities = opts.delete(:desired_capabilities) { W3CCapabilities.firefox }
  url                  = opts.delete(:url) { "http://#{Platform.localhost}:4444/wd/hub" }

  desired_capabilities = W3CCapabilities.send(desired_capabilities) if desired_capabilities.is_a? Symbol

  desired_capabilities[:marionette] = opts.delete(:marionette) unless opts[:marionette].nil?

  if desired_capabilities[:marionette] && Firefox::Binary.version < 45
      raise Error::WebDriverError, "Marionette is not supported in Firefox Version #{Firefox::Binary.version}"
  end

  unless opts.empty?
    raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
  end

  uri = url.kind_of?(URI) ? url : URI.parse(url)
  uri.path += "/" unless uri.path =~ /\/$/

  http_client.server_url = uri

  @http          = http_client
  @capabilities  = create_session(desired_capabilities)
  @file_detector = nil
end

Instance Attribute Details

#capabilitiesObject (readonly)

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.



54
55
56
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 54

def capabilities
  @capabilities
end

#contextObject

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.



53
54
55
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53

def context
  @context
end

#file_detectorObject

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.



53
54
55
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53

def file_detector
  @file_detector
end

#httpObject

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.



53
54
55
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 53

def http
  @http
end

Class Method Details

.command(name, verb, url) ⇒ Object

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.

Defines a wrapper method for a command, which ultimately calls #execute.

Parameters:

  • name (Symbol)

    name of the resulting method

  • verb (Symbol)

    the appropriate http verb, such as :get, :post, or :delete

  • url (String)

    a URL template, which can include some arguments, much like the definitions on the server. the :session_id parameter is implicitly handled, but the remainder will become required method arguments.



49
50
51
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 49

def self.command(name, verb, url)
  COMMANDS[name] = [verb, url.freeze]
end

Instance Method Details

#acceptAlertObject

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.

alerts



159
160
161
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 159

def acceptAlert
  execute :acceptAlert
end

#addCookie(cookie) ⇒ Object

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.

cookies



372
373
374
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 372

def addCookie(cookie)
  execute :addCookie, {}, :cookie => cookie
end

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



98
99
100
101
102
103
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 98

def browser
  @browser ||= (
    name = @capabilities.browser_name
    name ? name.gsub(" ", "_").to_sym : 'unknown'
  )
end

#clearElement(element) ⇒ Object

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.



440
441
442
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 440

def clearElement(element)
  execute :elementClear, :id => element
end

#clearLocalStorageObject

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.



306
307
308
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 306

def clearLocalStorage
  executeScript("localStorage.clear()")
end

#clearSessionStorageObject

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.



330
331
332
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 330

def clearSessionStorage
  executeScript("sessionStorage.clear()")
end

#clickObject

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.



401
402
403
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 401

def click
  execute :click, {}, :button => 0
end

#clickElement(element) ⇒ Object

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.

actions



397
398
399
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 397

def clickElement(element)
  execute :elementClick, :id => element
end

#closeObject

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.



226
227
228
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 226

def close
  execute :closeWindow
end

#contextClickObject

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.



409
410
411
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 409

def contextClick
  execute :click, {}, :button => 2
end

#create_session(desired_capabilities) ⇒ Object

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.



126
127
128
129
130
131
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 126

def create_session(desired_capabilities)
  resp = raw_execute :newSession, {}, :desiredCapabilities => desired_capabilities
  @session_id = resp['sessionId'] or raise Error::WebDriverError, 'no sessionId in returned payload'

  W3CCapabilities.json_create resp['value']
end

#deleteAllCookiesObject

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.



389
390
391
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 389

def deleteAllCookies
  getAllCookies.each { |cookie| deleteCookie(cookie['name'])}
end

#deleteCookie(name) ⇒ Object

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.



376
377
378
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 376

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

#dismissAlertObject

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.



163
164
165
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 163

def dismissAlert
  execute :dismissAlert
end

#doubleClickObject

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.



405
406
407
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 405

def doubleClick
  execute :doubleClick
end

#dragElement(element, right_by, down_by) ⇒ Object

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.



450
451
452
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 450

def dragElement(element, right_by, down_by)
  execute :dragElement, {:id => element}, :x => right_by, :y => down_by
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.



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 105

def driver_extensions
  [
    DriverExtensions::HasInputDevices,
    DriverExtensions::UploadsFiles,
    DriverExtensions::TakesScreenshot,
    DriverExtensions::HasSessionId,
    DriverExtensions::Rotatable,
    DriverExtensions::HasTouchScreen,
    DriverExtensions::HasRemoteStatus,
    DriverExtensions::HasWebStorage
  ]
end

#executeAsyncScript(script, *args) ⇒ Object

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.



363
364
365
366
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 363

def executeAsyncScript(script, *args)
  result = execute :executeAsyncScript, {}, :script => script, :args => args
  unwrap_script_result result
end

#executeScript(script, *args) ⇒ Object

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.

javascript execution



358
359
360
361
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 358

def executeScript(script, *args)
  result = execute :executeScript, {}, :script => script, :args => args
  unwrap_script_result result
end

#find_element_by(how, what, parent = nil) ⇒ Object

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.



572
573
574
575
576
577
578
579
580
581
582
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 572

def find_element_by(how, what, parent = nil)
  how, what = convert_locators(how, what)

  if parent
    id = execute :findChildElement, {:id => parent}, {:using => how, :value => what}
  else
    id = execute :findElement, {}, {:using => how, :value => what}
  end

  Element.new self, element_id_from(id)
end

#find_elements_by(how, what, parent = nil) ⇒ Object

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.



584
585
586
587
588
589
590
591
592
593
594
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 584

def find_elements_by(how, what, parent = nil)
  how, what = convert_locators(how, what)

  if parent
    ids = execute :findChildElements, {:id => parent}, {:using => how, :value => what}
  else
    ids = execute :findElements, {}, {:using => how, :value => what}
  end

  ids.map { |id| Element.new self, element_id_from(id) }
end

#fullscreenWindowObject

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.



261
262
263
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 261

def fullscreenWindow
  execute :fullscreenWindow
end

#get(url) ⇒ Object

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.



139
140
141
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 139

def get(url)
  execute :get, {}, :url => url
end

#getActiveElementObject Also known as: switchToActiveElement

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.

finding elements



567
568
569
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 567

def getActiveElement
  Element.new self, element_id_from(execute(:getActiveElement))
end

#getAlertTextObject

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.



171
172
173
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 171

def getAlertText
  execute :getAlertText
end

#getAllCookiesObject

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.



385
386
387
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 385

def getAllCookies
  execute :getAllCookies
end

#getCookie(name) ⇒ Object

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.

TODO - write specs



381
382
383
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 381

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

#getCurrentUrlObject

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.



187
188
189
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 187

def getCurrentUrl
  execute :getCurrentUrl
end

#getCurrentWindowHandleObject

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.



242
243
244
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 242

def getCurrentWindowHandle
  execute :getWindowHandle
end

#getElementAttribute(element, name) ⇒ Object

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.



516
517
518
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 516

def getElementAttribute(element, name)
  execute :getElementAttribute, :id => element, :name => name
end

#getElementLocation(element) ⇒ Object

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.



528
529
530
531
532
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 528

def getElementLocation(element)
  data = execute :getElementRect, :id => element

  Point.new data['x'], data['y']
end

#getElementLocationOnceScrolledIntoView(element) ⇒ Object

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.



534
535
536
537
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 534

def getElementLocationOnceScrolledIntoView(element)
  sendKeysToElement(element, [''])
  getElementLocation(element)
end

#getElementSize(element) ⇒ Object

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.



539
540
541
542
543
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 539

def getElementSize(element)
  data = execute :getElementRect, :id => element

  Dimension.new data['width'], data['height']
end

#getElementTagName(element) ⇒ Object

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.

element properties



512
513
514
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 512

def getElementTagName(element)
  execute :getElementTagName, :id => element
end

#getElementText(element) ⇒ Object

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.



524
525
526
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 524

def getElementText(element)
  execute :getElementText, :id => element
end

#getElementValue(element) ⇒ Object

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.



520
521
522
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 520

def getElementValue(element)
  execute :getElementProperty, :id => element, :name => 'value'
end

#getElementValueOfCssProperty(element, prop) ⇒ Object

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.



559
560
561
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 559

def getElementValueOfCssProperty(element, prop)
  execute :getElementCssValue, :id => element, :property_name => prop
end

#getLocalStorageItem(key) ⇒ Object

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.

HTML 5



290
291
292
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 290

def getLocalStorageItem(key)
  executeScript("return localStorage.getItem('#{key}')")
end

#getLocalStorageKeysObject

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.



298
299
300
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 298

def getLocalStorageKeys
  executeScript("return Object.keys(localStorage)")
end

#getLocalStorageSizeObject

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.



310
311
312
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 310

def getLocalStorageSize
  executeScript("return localStorage.length")
end

#getLocationObject

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.



338
339
340
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 338

def getLocation
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting location'
end

#getNetworkConnectionObject

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.



346
347
348
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 346

def getNetworkConnection
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting network connection'
end

#getPageSourceObject

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.



195
196
197
198
199
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 195

def getPageSource
  executeScript("var source = document.documentElement.outerHTML;" +
                    "if (!source) { source = new XMLSerializer().serializeToString(document); }" +
                    "return source;")
end

#getScreenOrientationObject

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.



504
505
506
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 504

def getScreenOrientation
  execute :getScreenOrientation
end

#getScreenshotObject

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.



282
283
284
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 282

def getScreenshot
  execute :takeScreenshot
end

#getSessionStorageItem(key) ⇒ Object

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.



314
315
316
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 314

def getSessionStorageItem(key)
  executeScript("return sessionStorage.getItem('#{key}')")
end

#getSessionStorageKeysObject

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.



322
323
324
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 322

def getSessionStorageKeys
  executeScript("return Object.keys(sessionStorage)")
end

#getSessionStorageSizeObject

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.



334
335
336
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 334

def getSessionStorageSize
  executeScript("return sessionStorage.length")
end

#getTitleObject

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.



191
192
193
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 191

def getTitle
  execute :getTitle
end

#getWindowHandlesObject

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.

window handling



238
239
240
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 238

def getWindowHandles
  execute :getWindowHandles
end

#getWindowPosition(_handle = nil) ⇒ Object

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.



278
279
280
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 278

def getWindowPosition(_handle = nil)
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support getting the Window Position'
end

#getWindowSize(handle = :current) ⇒ Object

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.



265
266
267
268
269
270
271
272
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 265

def getWindowSize(handle = :current)
  unless handle == :current
    raise Error::UnsupportedOperationError, 'Switch to desired window before getting its size'
  end
  data = execute :getWindowSize

  Dimension.new data['width'], data['height']
end

#goBackObject

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.

navigation



179
180
181
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 179

def goBack
  execute :back
end

#goForwardObject

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.



183
184
185
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 183

def goForward
  execute :forward
end

#isElementDisplayed(element) ⇒ Object

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.



553
554
555
556
557
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 553

def isElementDisplayed(element)
  jwp = Selenium::WebDriver::Remote::Bridge::COMMANDS[:isElementDisplayed]
  self.class.command(:isElementDisplayed, jwp.first, jwp.last)
  execute :isElementDisplayed, :id => element
end

#isElementEnabled(element) ⇒ Object

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.



545
546
547
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 545

def isElementEnabled(element)
  execute :isElementEnabled, :id => element
end

#isElementSelected(element) ⇒ Object

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.



549
550
551
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 549

def isElementSelected(element)
  execute :isElementSelected, :id => element
end

#maximizeWindow(handle = :current) ⇒ Object

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.



254
255
256
257
258
259
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 254

def maximizeWindow(handle = :current)
  unless handle == :current
    raise Error::UnsupportedOperationError, 'Switch to desired window before changing its size'
  end
  execute :maximizeWindow
end

#mouseDownObject

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.



413
414
415
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 413

def mouseDown
  execute :mouseDown
end

#mouseMoveTo(element, x = nil, y = nil) ⇒ Object

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.



421
422
423
424
425
426
427
428
429
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 421

def mouseMoveTo(element, x = nil, y = nil)
  params = { :element => element }

  if x && y
    params.merge! :xoffset => x, :yoffset => y
  end

  execute :mouseMoveTo, {}, params
end

#mouseUpObject

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.



417
418
419
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 417

def mouseUp
  execute :mouseUp
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.



220
221
222
223
224
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 220

def quit
  execute :deleteSession
  http.close
rescue *QUIT_ERRORS
end

#refreshObject

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.



230
231
232
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 230

def refresh
  execute :refresh
end

#removeLocalStorageItem(key) ⇒ Object

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.



294
295
296
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 294

def removeLocalStorageItem(key)
  executeScript("localStorage.removeItem('#{key}')")
end

#removeSessionStorageItem(key) ⇒ Object

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.



318
319
320
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 318

def removeSessionStorageItem(key)
  executeScript("sessionStorage.removeItem('#{key}')")
end

#sendKeysToActiveElement(keys) ⇒ Object

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.



431
432
433
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 431

def sendKeysToActiveElement(keys)
  sendKeysToElement(getActiveElement, keys)
end

#sendKeysToElement(element, keys) ⇒ Object

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.

TODO - Implement file verification



436
437
438
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 436

def sendKeysToElement(element, keys)
  execute :elementSendKeys, {:id => element}, {:value => keys.join('').split(//)}
end

#session_idObject

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 the current session ID.



122
123
124
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 122

def session_id
  @session_id || raise(Error::WebDriverError, "no current session exists")
end

#setAlertValue(keys) ⇒ Object

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.



167
168
169
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 167

def setAlertValue(keys)
  execute :sendAlertText, {}, {:handler => 'prompt', :message => keys}
end

#setImplicitWaitTimeout(milliseconds) ⇒ Object

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.



143
144
145
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 143

def setImplicitWaitTimeout(milliseconds)
  setTimeout('implicit', milliseconds)
end

#setLocalStorageItem(key, value) ⇒ Object

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.



302
303
304
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 302

def setLocalStorageItem(key, value)
  executeScript("localStorage.setItem('#{key}', '#{value}')")
end

#setLocation(_lat, _lon, _alt) ⇒ Object

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.



342
343
344
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 342

def setLocation(_lat, _lon, _alt)
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting location'
end

#setNetworkConnection(_type) ⇒ Object

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.



350
351
352
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 350

def setNetworkConnection(_type)
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting network connection'
end

#setScreenOrientation(orientation) ⇒ Object

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.



500
501
502
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 500

def setScreenOrientation(orientation)
  execute :setScreenOrientation, {}, :orientation => orientation
end

#setScriptTimeout(milliseconds) ⇒ Object

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.



147
148
149
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 147

def setScriptTimeout(milliseconds)
  setTimeout('script', milliseconds)
end

#setSessionStorageItem(key, value) ⇒ Object

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.



326
327
328
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 326

def setSessionStorageItem(key, value)
  executeScript("sessionStorage.setItem('#{key}', '#{value}')")
end

#setTimeout(type, milliseconds) ⇒ Object

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.



151
152
153
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 151

def setTimeout(type, milliseconds)
  execute :setTimeout, {}, :type => type, :ms => milliseconds
end

#setWindowPosition(_x, _y, _handle = nil) ⇒ Object

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.



274
275
276
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 274

def setWindowPosition(_x, _y, _handle = nil)
  raise Error::UnsupportedOperationError, 'The W3C standard does not currently support setting the Window Position'
end

#setWindowSize(width, height, handle = :current) ⇒ Object

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.



246
247
248
249
250
251
252
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 246

def setWindowSize(width, height, handle = :current)
  unless handle == :current
    raise Error::WebDriverError, 'Switch to desired window before changing its size'
  end
  execute :setWindowSize, {}, {:width  => width,
                           :height => height}
end

#statusObject

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.



133
134
135
136
137
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 133

def status
  jwp = Selenium::WebDriver::Remote::Bridge::COMMANDS[:status]
  self.class.command(:status, jwp.first, jwp.last)
  execute :status
end

#submitElement(element) ⇒ Object

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.



444
445
446
447
448
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 444

def submitElement(element)
  executeScript("var e = arguments[0].ownerDocument.createEvent('Event');" +
                    "e.initEvent('submit', true, true);" +
                    "if (arguments[0].dispatchEvent(e)) { arguments[0].submit() }", element)
end

#switchToDefaultContentObject

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.



214
215
216
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 214

def switchToDefaultContent
  switchToFrame nil
end

#switchToFrame(id) ⇒ Object

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.



205
206
207
208
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 205

def switchToFrame(id)
  id = find_element_by('id', id) if id.is_a? String
  execute :switchToFrame, {}, :id => id
end

#switchToParentFrameObject

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.



210
211
212
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 210

def switchToParentFrame
  execute :switchToParentFrame
end

#switchToWindow(name) ⇒ Object

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.



201
202
203
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 201

def switchToWindow(name)
  execute :switchToWindow, {}, :handle => name
end

#touchDoubleTap(element) ⇒ Object

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.



458
459
460
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 458

def touchDoubleTap(element)
  execute :touchDoubleTap, {}, :element => element
end

#touchDown(x, y) ⇒ Object

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.



466
467
468
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 466

def touchDown(x, y)
  execute :touchDown, {}, :x => x, :y => y
end

#touchElementFlick(element, right_by, down_by, speed) ⇒ Object

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.



492
493
494
495
496
497
498
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 492

def touchElementFlick(element, right_by, down_by, speed)
  execute :touchFlick, {}, :element => element,
                           :xoffset => right_by,
                           :yoffset => down_by,
                           :speed   => speed

end

#touchFlick(xspeed, yspeed) ⇒ Object

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.



488
489
490
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 488

def touchFlick(xspeed, yspeed)
  execute :touchFlick, {}, :xspeed => xspeed, :yspeed => yspeed
end

#touchLongPress(element) ⇒ Object

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.



462
463
464
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 462

def touchLongPress(element)
  execute :touchLongPress, {}, :element => element
end

#touchMove(x, y) ⇒ Object

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.



474
475
476
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 474

def touchMove(x, y)
  execute :touchMove, {}, :x => x, :y => y
end

#touchScroll(element, x, y) ⇒ Object

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.



478
479
480
481
482
483
484
485
486
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 478

def touchScroll(element, x, y)
  if element
    execute :touchScroll, {}, :element => element,
                              :xoffset => x,
                              :yoffset => y
  else
    execute :touchScroll, {}, :xoffset => x, :yoffset => y
  end
end

#touchSingleTap(element) ⇒ Object

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.



454
455
456
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 454

def touchSingleTap(element)
  execute :touchSingleTap, {}, :element => element
end

#touchUp(x, y) ⇒ Object

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.



470
471
472
# File 'lib/selenium/webdriver/remote/w3c_bridge.rb', line 470

def touchUp(x, y)
  execute :touchUp, {}, :x => x, :y => y
end