Class: Selenium::WebDriver::Remote::Bridge Private

Inherits:
Object
  • Object
show all
Includes:
BridgeHelper
Defined in:
lib/selenium/webdriver/remote/bridge.rb,
lib/selenium/webdriver/remote/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.

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 = {}) ⇒ 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.

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



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

def initialize(opts = {})
  opts = opts.dup

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

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

  if desired_capabilities.kind_of?(Symbol)
    unless Capabilities.respond_to?(desired_capabilities)
      raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
    end

    desired_capabilities = Capabilities.send(desired_capabilities)
  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.



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

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.



51
52
53
# File 'lib/selenium/webdriver/remote/bridge.rb', line 51

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.



51
52
53
# File 'lib/selenium/webdriver/remote/bridge.rb', line 51

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.



51
52
53
# File 'lib/selenium/webdriver/remote/bridge.rb', line 51

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

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

  • verb (Symbol)

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



47
48
49
# File 'lib/selenium/webdriver/remote/bridge.rb', line 47

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



157
158
159
# File 'lib/selenium/webdriver/remote/bridge.rb', line 157

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



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

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.



92
93
94
95
96
97
# File 'lib/selenium/webdriver/remote/bridge.rb', line 92

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.



438
439
440
# File 'lib/selenium/webdriver/remote/bridge.rb', line 438

def clearElement(element)
  execute :clearElement, :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.



292
293
294
# File 'lib/selenium/webdriver/remote/bridge.rb', line 292

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



316
317
318
# File 'lib/selenium/webdriver/remote/bridge.rb', line 316

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



388
389
390
# File 'lib/selenium/webdriver/remote/bridge.rb', line 388

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



384
385
386
# File 'lib/selenium/webdriver/remote/bridge.rb', line 384

def clickElement(element)
  execute :clickElement, :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.



221
222
223
# File 'lib/selenium/webdriver/remote/bridge.rb', line 221

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



396
397
398
# File 'lib/selenium/webdriver/remote/bridge.rb', line 396

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.



122
123
124
125
126
127
# File 'lib/selenium/webdriver/remote/bridge.rb', line 122

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'

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



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

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



368
369
370
# File 'lib/selenium/webdriver/remote/bridge.rb', line 368

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.



161
162
163
# File 'lib/selenium/webdriver/remote/bridge.rb', line 161

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.



392
393
394
# File 'lib/selenium/webdriver/remote/bridge.rb', line 392

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.



446
447
448
# File 'lib/selenium/webdriver/remote/bridge.rb', line 446

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.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/selenium/webdriver/remote/bridge.rb', line 99

def driver_extensions
  [
    DriverExtensions::HasInputDevices,
    DriverExtensions::UploadsFiles,
    DriverExtensions::TakesScreenshot,
    DriverExtensions::HasSessionId,
    DriverExtensions::Rotatable,
    DriverExtensions::HasTouchScreen,
    DriverExtensions::HasLocation,
    DriverExtensions::HasNetworkConnection,
    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.



353
354
355
356
357
358
# File 'lib/selenium/webdriver/remote/bridge.rb', line 353

def executeAsyncScript(script, *args)
  assert_javascript_enabled

  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



346
347
348
349
350
351
# File 'lib/selenium/webdriver/remote/bridge.rb', line 346

def executeScript(script, *args)
  assert_javascript_enabled

  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.



588
589
590
591
592
593
594
595
596
# File 'lib/selenium/webdriver/remote/bridge.rb', line 588

def find_element_by(how, what, parent = nil)
  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.



598
599
600
601
602
603
604
605
606
# File 'lib/selenium/webdriver/remote/bridge.rb', line 598

def find_elements_by(how, what, parent = nil)
  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

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



133
134
135
# File 'lib/selenium/webdriver/remote/bridge.rb', line 133

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



583
584
585
# File 'lib/selenium/webdriver/remote/bridge.rb', line 583

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.



169
170
171
# File 'lib/selenium/webdriver/remote/bridge.rb', line 169

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.



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

def getAllCookies
  execute :getCookies
end

#getAvailableLogTypesObject

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.

logs



508
509
510
511
# File 'lib/selenium/webdriver/remote/bridge.rb', line 508

def getAvailableLogTypes
  types = execute :getAvailableLogTypes
  Array(types).map { |e| e.to_sym }
end

#getCapabilitiesObject

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.



137
138
139
# File 'lib/selenium/webdriver/remote/bridge.rb', line 137

def getCapabilities
  Capabilities.json_create execute(:getCapabilities)
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.



185
186
187
# File 'lib/selenium/webdriver/remote/bridge.rb', line 185

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.



237
238
239
# File 'lib/selenium/webdriver/remote/bridge.rb', line 237

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



533
534
535
# File 'lib/selenium/webdriver/remote/bridge.rb', line 533

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.



545
546
547
548
549
# File 'lib/selenium/webdriver/remote/bridge.rb', line 545

def getElementLocation(element)
  data = execute :getElementLocation, :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.



551
552
553
554
555
# File 'lib/selenium/webdriver/remote/bridge.rb', line 551

def getElementLocationOnceScrolledIntoView(element)
  data = execute :getElementLocationOnceScrolledIntoView, :id => element

  Point.new data['x'], data['y']
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.



557
558
559
560
561
# File 'lib/selenium/webdriver/remote/bridge.rb', line 557

def getElementSize(element)
  data = execute :getElementSize, :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



529
530
531
# File 'lib/selenium/webdriver/remote/bridge.rb', line 529

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.



541
542
543
# File 'lib/selenium/webdriver/remote/bridge.rb', line 541

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.



537
538
539
# File 'lib/selenium/webdriver/remote/bridge.rb', line 537

def getElementValue(element)
  execute :getElementValue, :id => element
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.



575
576
577
# File 'lib/selenium/webdriver/remote/bridge.rb', line 575

def getElementValueOfCssProperty(element, prop)
  execute :getElementValueOfCssProperty, :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



276
277
278
# File 'lib/selenium/webdriver/remote/bridge.rb', line 276

def getLocalStorageItem(key)
  execute :getLocalStorageItem, :key => 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.



284
285
286
# File 'lib/selenium/webdriver/remote/bridge.rb', line 284

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



296
297
298
# File 'lib/selenium/webdriver/remote/bridge.rb', line 296

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



324
325
326
327
# File 'lib/selenium/webdriver/remote/bridge.rb', line 324

def getLocation
  obj = execute(:getLocation) || {} # android returns null
  Location.new obj['latitude'], obj['longitude'], obj['altitude']
end

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



513
514
515
516
517
518
519
520
521
522
523
# File 'lib/selenium/webdriver/remote/bridge.rb', line 513

def getLog(type)
  data = execute :getLog, {}, :type => type.to_s

  Array(data).map do |l|
    begin
      LogEntry.new l.fetch('level', 'UNKNOWN'), l.fetch('timestamp'), l.fetch('message')
    rescue KeyError
      next
    end
  end
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.



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

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



193
194
195
# File 'lib/selenium/webdriver/remote/bridge.rb', line 193

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



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

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.



268
269
270
# File 'lib/selenium/webdriver/remote/bridge.rb', line 268

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



300
301
302
# File 'lib/selenium/webdriver/remote/bridge.rb', line 300

def getSessionStorageItem(key)
  execute :getSessionStorageItem, :key => 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.



308
309
310
# File 'lib/selenium/webdriver/remote/bridge.rb', line 308

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



320
321
322
# File 'lib/selenium/webdriver/remote/bridge.rb', line 320

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



189
190
191
# File 'lib/selenium/webdriver/remote/bridge.rb', line 189

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



233
234
235
# File 'lib/selenium/webdriver/remote/bridge.rb', line 233

def getWindowHandles
  execute :getWindowHandles
end

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



262
263
264
265
266
# File 'lib/selenium/webdriver/remote/bridge.rb', line 262

def getWindowPosition(handle = :current)
  data = execute :getWindowPosition, :window_handle => handle

  Point.new data['x'], data['y']
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.



251
252
253
254
255
# File 'lib/selenium/webdriver/remote/bridge.rb', line 251

def getWindowSize(handle = :current)
  data = execute :getWindowSize, :window_handle => handle

  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



177
178
179
# File 'lib/selenium/webdriver/remote/bridge.rb', line 177

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



181
182
183
# File 'lib/selenium/webdriver/remote/bridge.rb', line 181

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



571
572
573
# File 'lib/selenium/webdriver/remote/bridge.rb', line 571

def isElementDisplayed(element)
  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.



563
564
565
# File 'lib/selenium/webdriver/remote/bridge.rb', line 563

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.



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

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.



247
248
249
# File 'lib/selenium/webdriver/remote/bridge.rb', line 247

def maximizeWindow(handle = :current)
  execute :maximizeWindow, :window_handle => handle
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.



400
401
402
# File 'lib/selenium/webdriver/remote/bridge.rb', line 400

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.



408
409
410
411
412
413
414
415
416
# File 'lib/selenium/webdriver/remote/bridge.rb', line 408

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.



404
405
406
# File 'lib/selenium/webdriver/remote/bridge.rb', line 404

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.



215
216
217
218
219
# File 'lib/selenium/webdriver/remote/bridge.rb', line 215

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



225
226
227
# File 'lib/selenium/webdriver/remote/bridge.rb', line 225

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.



280
281
282
# File 'lib/selenium/webdriver/remote/bridge.rb', line 280

def removeLocalStorageItem(key)
  execute :removeLocalStorageItem, :key => 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.



304
305
306
# File 'lib/selenium/webdriver/remote/bridge.rb', line 304

def removeSessionStorageItem(key)
  execute :removeSessionStorageItem, :key => key
end

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



418
419
420
# File 'lib/selenium/webdriver/remote/bridge.rb', line 418

def sendKeysToActiveElement(key)
  execute :sendKeysToActiveElement, {}, :value => key
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.



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

def sendKeysToElement(element, keys)
  if @file_detector && local_file = @file_detector.call(keys)
    keys = upload(local_file)
  end

  execute :sendKeysToElement, {:id => element}, {:value => Array(keys)}
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.



118
119
120
# File 'lib/selenium/webdriver/remote/bridge.rb', line 118

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.



165
166
167
# File 'lib/selenium/webdriver/remote/bridge.rb', line 165

def setAlertValue(keys)
  execute :setAlertValue, {}, :text => keys.to_s
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.



141
142
143
# File 'lib/selenium/webdriver/remote/bridge.rb', line 141

def setImplicitWaitTimeout(milliseconds)
  execute :implicitlyWait, {}, :ms => 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.



288
289
290
# File 'lib/selenium/webdriver/remote/bridge.rb', line 288

def setLocalStorageItem(key, value)
  execute :setLocalStorageItem, {}, :key => key, :value => 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.



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

def setLocation(lat, lon, alt)
  loc = {:latitude => lat, :longitude => lon, :altitude => alt}
  execute :setLocation, {}, :location => loc
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.



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

def setNetworkConnection(type)
  execute :setNetworkConnection, {}, :parameters => {:type => type}
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.



496
497
498
# File 'lib/selenium/webdriver/remote/bridge.rb', line 496

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.



145
146
147
# File 'lib/selenium/webdriver/remote/bridge.rb', line 145

def setScriptTimeout(milliseconds)
  execute :setScriptTimeout, {}, :ms => 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.



312
313
314
# File 'lib/selenium/webdriver/remote/bridge.rb', line 312

def setSessionStorageItem(key, value)
  execute :setSessionStorageItem, {}, :key => key, :value => 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.



149
150
151
# File 'lib/selenium/webdriver/remote/bridge.rb', line 149

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

#setWindowPosition(x, y, 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.



257
258
259
260
# File 'lib/selenium/webdriver/remote/bridge.rb', line 257

def setWindowPosition(x, y, handle = :current)
  execute :setWindowPosition, {:window_handle => handle},
                               :x => x, :y => y
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.



241
242
243
244
245
# File 'lib/selenium/webdriver/remote/bridge.rb', line 241

def setWindowSize(width, height, handle = :current)
  execute :setWindowSize, {:window_handle => handle},
                           :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.



129
130
131
# File 'lib/selenium/webdriver/remote/bridge.rb', line 129

def status
  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.



442
443
444
# File 'lib/selenium/webdriver/remote/bridge.rb', line 442

def submitElement(element)
  execute :submitElement, :id => 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.



209
210
211
# File 'lib/selenium/webdriver/remote/bridge.rb', line 209

def switchToDefaultContent
  execute :switchToFrame, {}, :id => 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.



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

def switchToFrame(id)
  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.



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

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.



197
198
199
# File 'lib/selenium/webdriver/remote/bridge.rb', line 197

def switchToWindow(name)
  execute :switchToWindow, {}, :name => 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.



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

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.



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

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.



488
489
490
491
492
493
494
# File 'lib/selenium/webdriver/remote/bridge.rb', line 488

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.



484
485
486
# File 'lib/selenium/webdriver/remote/bridge.rb', line 484

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.



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

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.



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

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.



474
475
476
477
478
479
480
481
482
# File 'lib/selenium/webdriver/remote/bridge.rb', line 474

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.



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

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.



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

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

#upload(local_file) ⇒ 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.



430
431
432
433
434
435
436
# File 'lib/selenium/webdriver/remote/bridge.rb', line 430

def upload(local_file)
  unless File.file?(local_file)
    raise Error::WebDriverError, "you may only upload files: #{local_file.inspect}"
  end

  execute :uploadFile, {}, :file => Zipper.zip_file(local_file)
end