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

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 collapse

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/selenium/webdriver/remote/bridge.rb', line 43

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



33
34
35
# File 'lib/selenium/webdriver/remote/bridge.rb', line 33

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.



32
33
34
# File 'lib/selenium/webdriver/remote/bridge.rb', line 32

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.



32
33
34
# File 'lib/selenium/webdriver/remote/bridge.rb', line 32

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.



32
33
34
# File 'lib/selenium/webdriver/remote/bridge.rb', line 32

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



28
29
30
# File 'lib/selenium/webdriver/remote/bridge.rb', line 28

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.



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

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.



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

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.



71
72
73
# File 'lib/selenium/webdriver/remote/bridge.rb', line 71

def browser
  @browser ||= @capabilities.browser_name.gsub(" ", "_").to_sym
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.



351
352
353
# File 'lib/selenium/webdriver/remote/bridge.rb', line 351

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



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

def deleteCookie(name)
  execute :deleteCookieNamed, :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.



126
127
128
# File 'lib/selenium/webdriver/remote/bridge.rb', line 126

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.



271
272
273
# File 'lib/selenium/webdriver/remote/bridge.rb', line 271

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.



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

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.



75
76
77
78
79
80
81
# File 'lib/selenium/webdriver/remote/bridge.rb', line 75

def driver_extensions
  [
    DriverExtensions::HasInputDevices,
    DriverExtensions::UploadsFiles,
    DriverExtensions::TakesScreenshot
  ]
end

#elementEquals(element, other) ⇒ 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.



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

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



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

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.



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

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.



392
393
394
395
396
397
398
399
400
# File 'lib/selenium/webdriver/remote/bridge.rb', line 392

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.



402
403
404
405
406
407
408
409
410
# File 'lib/selenium/webdriver/remote/bridge.rb', line 402

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.



98
99
100
# File 'lib/selenium/webdriver/remote/bridge.rb', line 98

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.



379
380
381
# File 'lib/selenium/webdriver/remote/bridge.rb', line 379

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

#getAlertObject

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



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

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



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

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.



255
256
257
# File 'lib/selenium/webdriver/remote/bridge.rb', line 255

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



102
103
104
# File 'lib/selenium/webdriver/remote/bridge.rb', line 102

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.



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

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.



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

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.



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

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.



317
318
319
320
321
# File 'lib/selenium/webdriver/remote/bridge.rb', line 317

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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



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

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



229
230
231
# File 'lib/selenium/webdriver/remote/bridge.rb', line 229

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



154
155
156
# File 'lib/selenium/webdriver/remote/bridge.rb', line 154

def getTitle
  execute :getTitle
end

#getVisibleObject

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.



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

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



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

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.



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

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.



212
213
214
215
216
# File 'lib/selenium/webdriver/remote/bridge.rb', line 212

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



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

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.



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

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.



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

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.



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

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.



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

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



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

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.



287
288
289
290
291
292
293
294
295
# File 'lib/selenium/webdriver/remote/bridge.rb', line 287

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.



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

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.



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

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.



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

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



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

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.



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

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.



87
88
89
# File 'lib/selenium/webdriver/remote/bridge.rb', line 87

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.



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

def setAlertValue(keys)
  execute :setAlertValue, {}, :text => keys.to_s
end

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



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

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



106
107
108
# File 'lib/selenium/webdriver/remote/bridge.rb', line 106

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



110
111
112
# File 'lib/selenium/webdriver/remote/bridge.rb', line 110

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

#setVisible(bool) ⇒ 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.



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

def setVisible(bool)
  execute :setVisible, {}, bool
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.



218
219
220
221
# File 'lib/selenium/webdriver/remote/bridge.rb', line 218

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.



206
207
208
209
210
# File 'lib/selenium/webdriver/remote/bridge.rb', line 206

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



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

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.



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

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.



174
175
176
# File 'lib/selenium/webdriver/remote/bridge.rb', line 174

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



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

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



343
344
345
346
347
348
349
# File 'lib/selenium/webdriver/remote/bridge.rb', line 343

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

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