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

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

github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#command-reference

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.

{
  get_capabilities: [:get, 'session/:session_id'.freeze],
  status: [:get, 'status'.freeze],

  #
  # basic driver
  #

  get_current_url: [:get, 'session/:session_id/url'.freeze],
  get: [:post, 'session/:session_id/url'.freeze],
  go_forward: [:post, 'session/:session_id/forward'.freeze],
  go_back: [:post, 'session/:session_id/back'.freeze],
  refresh: [:post, 'session/:session_id/refresh'.freeze],
  quit: [:delete, 'session/:session_id'.freeze],
  close: [:delete, 'session/:session_id/window'.freeze],
  get_page_source: [:get, 'session/:session_id/source'.freeze],
  get_title: [:get, 'session/:session_id/title'.freeze],
  find_element: [:post, 'session/:session_id/element'.freeze],
  find_elements: [:post, 'session/:session_id/elements'.freeze],
  get_active_element: [:post, 'session/:session_id/element/active'.freeze],

  #
  # window handling
  #

  get_current_window_handle: [:get, 'session/:session_id/window_handle'.freeze],
  get_window_handles: [:get, 'session/:session_id/window_handles'.freeze],
  set_window_size: [:post, 'session/:session_id/window/:window_handle/size'.freeze],
  set_window_position: [:post, 'session/:session_id/window/:window_handle/position'.freeze],
  get_window_size: [:get, 'session/:session_id/window/:window_handle/size'.freeze],
  get_window_position: [:get, 'session/:session_id/window/:window_handle/position'.freeze],
  maximize_window: [:post, 'session/:session_id/window/:window_handle/maximize'.freeze],

  #
  # script execution
  #

  execute_script: [:post, 'session/:session_id/execute'.freeze],
  execute_async_script: [:post, 'session/:session_id/execute_async'.freeze],

  #
  # screenshot
  #

  screenshot: [:get, 'session/:session_id/screenshot'.freeze],

  #
  # alerts
  #

  dismiss_alert: [:post, 'session/:session_id/dismiss_alert'.freeze],
  accept_alert: [:post, 'session/:session_id/accept_alert'.freeze],
  get_alert_text: [:get, 'session/:session_id/alert_text'.freeze],
  set_alert_value: [:post, 'session/:session_id/alert_text'.freeze],
  set_authentication: [:post, 'session/:session_id/alert/credentials'.freeze],

  #
  # target locator
  #

  switch_to_frame: [:post, 'session/:session_id/frame'.freeze],
  switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'.freeze],
  switch_to_window: [:post, 'session/:session_id/window'.freeze],

  #
  # options
  #

  get_cookies: [:get, 'session/:session_id/cookie'.freeze],
  add_cookie: [:post, 'session/:session_id/cookie'.freeze],
  delete_all_cookies: [:delete, 'session/:session_id/cookie'.freeze],
  delete_cookie: [:delete, 'session/:session_id/cookie/:name'.freeze],

  #
  # timeouts
  #

  implicitly_wait: [:post, 'session/:session_id/timeouts/implicit_wait'.freeze],
  set_script_timeout: [:post, 'session/:session_id/timeouts/async_script'.freeze],
  set_timeout: [:post, 'session/:session_id/timeouts'.freeze],

  #
  # element
  #

  describe_element: [:get, 'session/:session_id/element/:id'.freeze],
  find_child_element: [:post, 'session/:session_id/element/:id/element'.freeze],
  find_child_elements: [:post, 'session/:session_id/element/:id/elements'.freeze],
  click_element: [:post, 'session/:session_id/element/:id/click'.freeze],
  submit_element: [:post, 'session/:session_id/element/:id/submit'.freeze],
  get_element_value: [:get, 'session/:session_id/element/:id/value'.freeze],
  send_keys_to_element: [:post, 'session/:session_id/element/:id/value'.freeze],
  upload_file: [:post, 'session/:session_id/file'.freeze],
  get_element_tag_name: [:get, 'session/:session_id/element/:id/name'.freeze],
  clear_element: [:post, 'session/:session_id/element/:id/clear'.freeze],
  is_element_selected: [:get, 'session/:session_id/element/:id/selected'.freeze],
  is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'.freeze],
  get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'.freeze],
  element_equals: [:get, 'session/:session_id/element/:id/equals/:other'.freeze],
  is_element_displayed: [:get, 'session/:session_id/element/:id/displayed'.freeze],
  get_element_location: [:get, 'session/:session_id/element/:id/location'.freeze],
  get_element_location_once_scrolled_into_view: [:get, 'session/:session_id/element/:id/location_in_view'.freeze],
  get_element_size: [:get, 'session/:session_id/element/:id/size'.freeze],
  drag_element: [:post, 'session/:session_id/element/:id/drag'.freeze],
  get_element_value_of_css_property: [:get, 'session/:session_id/element/:id/css/:property_name'.freeze],
  get_element_text: [:get, 'session/:session_id/element/:id/text'.freeze],

  #
  # rotatable
  #

  get_screen_orientation: [:get, 'session/:session_id/orientation'.freeze],
  set_screen_orientation: [:post, 'session/:session_id/orientation'.freeze],

  #
  # interactions API
  #

  click: [:post, 'session/:session_id/click'.freeze],
  double_click: [:post, 'session/:session_id/doubleclick'.freeze],
  mouse_down: [:post, 'session/:session_id/buttondown'.freeze],
  mouse_up: [:post, 'session/:session_id/buttonup'.freeze],
  mouse_move_to: [:post, 'session/:session_id/moveto'.freeze],
  send_modifier_key_to_active_element: [:post, 'session/:session_id/modifier'.freeze],
  send_keys_to_active_element: [:post, 'session/:session_id/keys'.freeze],

  #
  # html 5
  #

  execute_sql: [:post, 'session/:session_id/execute_sql'.freeze],

  get_location: [:get, 'session/:session_id/location'.freeze],
  set_location: [:post, 'session/:session_id/location'.freeze],

  get_app_cache: [:get, 'session/:session_id/application_cache'.freeze],
  get_app_cache_status: [:get, 'session/:session_id/application_cache/status'.freeze],
  clear_app_cache: [:delete, 'session/:session_id/application_cache/clear'.freeze],

  get_network_connection: [:get, 'session/:session_id/network_connection'.freeze],
  set_network_connection: [:post, 'session/:session_id/network_connection'.freeze],

  get_local_storage_item: [:get, 'session/:session_id/local_storage/key/:key'.freeze],
  remove_local_storage_item: [:delete, 'session/:session_id/local_storage/key/:key'.freeze],
  get_local_storage_keys: [:get, 'session/:session_id/local_storage'.freeze],
  set_local_storage_item: [:post, 'session/:session_id/local_storage'.freeze],
  clear_local_storage: [:delete, 'session/:session_id/local_storage'.freeze],
  get_local_storage_size: [:get, 'session/:session_id/local_storage/size'.freeze],

  get_session_storage_item: [:get, 'session/:session_id/session_storage/key/:key'.freeze],
  remove_session_storage_item: [:delete, 'session/:session_id/session_storage/key/:key'.freeze],
  get_session_storage_keys: [:get, 'session/:session_id/session_storage'.freeze],
  set_session_storage_item: [:post, 'session/:session_id/session_storage'.freeze],
  clear_session_storage: [:delete, 'session/:session_id/session_storage'.freeze],
  get_session_storage_size: [:get, 'session/:session_id/session_storage/size'.freeze],

  #
  # ime
  #

  ime_get_available_engines: [:get, 'session/:session_id/ime/available_engines'.freeze],
  ime_get_active_engine: [:get, 'session/:session_id/ime/active_engine'.freeze],
  ime_is_activated: [:get, 'session/:session_id/ime/activated'.freeze],
  ime_deactivate: [:post, 'session/:session_id/ime/deactivate'.freeze],
  ime_activate_engine: [:post, 'session/:session_id/ime/activate'.freeze],

  #
  # touch
  #

  touch_single_tap: [:post, 'session/:session_id/touch/click'.freeze],
  touch_double_tap: [:post, 'session/:session_id/touch/doubleclick'.freeze],
  touch_long_press: [:post, 'session/:session_id/touch/longclick'.freeze],
  touch_down: [:post, 'session/:session_id/touch/down'.freeze],
  touch_up: [:post, 'session/:session_id/touch/up'.freeze],
  touch_move: [:post, 'session/:session_id/touch/move'.freeze],
  touch_scroll: [:post, 'session/:session_id/touch/scroll'.freeze],
  touch_flick: [:post, 'session/:session_id/touch/flick'.freeze],

  #
  # logs
  #

  get_available_log_types: [:get, 'session/:session_id/log/types'.freeze],
  get_log: [:post, 'session/:session_id/log'.freeze]
}.freeze

Constants inherited from Bridge

Bridge::PORT

Instance Attribute Summary

Attributes inherited from Bridge

#capabilities, #context, #file_detector, #http

Instance Method Summary collapse

Methods inherited from Bridge

#browser, #create_session, handshake, #session_id

Methods included from BridgeHelper

#element_id_from, #parse_cookie_string, #unwrap_script_result

Constructor Details

#initialize(capabilities, session_id, **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.

Returns a new instance of Bridge.



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

def initialize(capabilities, session_id, **opts)
  @capabilities = capabilities
  @session_id = session_id
  super(opts)
end

Instance Method Details

#accept_alertObject

This method is 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



73
74
75
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 73

def accept_alert
  execute :accept_alert
end

#actionActionBuilder



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

def action
  ActionBuilder.new Mouse.new(self), Keyboard.new(self)
end

#active_elementObject Also known as: switch_to_active_element

This method is 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



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

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

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



286
287
288
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 286

def add_cookie(cookie)
  execute :add_cookie, {}, {cookie: cookie}
end

#alert=(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.



81
82
83
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 81

def alert=(keys)
  execute :set_alert_value, {}, {text: keys.to_s}
end

#alert_textObject

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



85
86
87
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 85

def alert_text
  execute :get_alert_text
end

#authentication(credentials) ⇒ 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.



89
90
91
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 89

def authentication(credentials)
  execute :set_authentication, {}, credentials
end

#available_log_typesObject

This method is 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



455
456
457
458
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 455

def available_log_types
  types = execute :get_available_log_types
  Array(types).map(&:to_sym)
end

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



386
387
388
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 386

def clear_element(element)
  execute :clear_element, id: element
end

#clear_local_storageObject

This method is 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/oss/bridge.rb', line 210

def clear_local_storage
  execute :clear_local_storage
end

#clear_session_storageObject

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



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

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



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

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

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



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

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



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

def close
  execute :close
end

#commands(command) ⇒ 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.



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

def commands(command)
  COMMANDS[command]
end

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



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

def context_click
  execute :click, {}, {button: 2}
end

#cookiesObject

This method is 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/oss/bridge.rb', line 294

def cookies
  execute :get_cookies
end

#delete_all_cookiesObject

This method is 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/oss/bridge.rb', line 298

def delete_all_cookies
  execute :delete_all_cookies
end

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



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

def delete_cookie(name)
  execute :delete_cookie, name: name
end

#dialectObject

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



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

def dialect
  :oss
end

#dismiss_alertObject

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



77
78
79
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 77

def dismiss_alert
  execute :dismiss_alert
end

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



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

def double_click
  execute :double_click
end

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



394
395
396
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 394

def drag_element(element, right_by, down_by)
  execute :drag_element, {id: element}, {x: right_by, y: down_by}
end

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



480
481
482
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 480

def element_attribute(element, name)
  execute :get_element_attribute, id: element.ref, name: name
end

#element_displayed?(element) ⇒ Boolean

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



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

def element_displayed?(element)
  execute :is_element_displayed, id: element
end

#element_enabled?(element) ⇒ Boolean

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



522
523
524
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 522

def element_enabled?(element)
  execute :is_element_enabled, id: element
end

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



497
498
499
500
501
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 497

def element_location(element)
  data = execute :get_element_location, id: element

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

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



510
511
512
513
514
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 510

def element_location_once_scrolled_into_view(element)
  data = execute :get_element_location_once_scrolled_into_view, id: element

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

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

Backwards compatibility for w3c



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

def element_property(element, name)
  execute_script 'return arguments[0][arguments[1]]', element, name
end

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



503
504
505
506
507
508
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 503

def element_rect(element)
  loc = execute :get_element_location, id: element
  size = execute :get_element_size, id: element

  Rectangle.new loc['x'], loc['y'], size['width'], size['height']
end

#element_selected?(element) ⇒ Boolean

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



526
527
528
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 526

def element_selected?(element)
  execute :is_element_selected, id: element
end

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



516
517
518
519
520
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 516

def element_size(element)
  data = execute :get_element_size, id: element

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

#element_tag_name(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



476
477
478
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 476

def element_tag_name(element)
  execute :get_element_tag_name, id: element
end

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



493
494
495
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 493

def element_text(element)
  execute :get_element_text, id: element
end

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



489
490
491
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 489

def element_value(element)
  execute :get_element_value, id: element
end

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



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

def element_value_of_css_property(element, prop)
  execute :get_element_value_of_css_property, id: element, property_name: prop
end

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



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

def execute_async_script(script, *args)
  assert_javascript_enabled

  result = execute :execute_async_script, {}, {script: script, args: args}
  unwrap_script_result result
end

#execute_script(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



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

def execute_script(script, *args)
  assert_javascript_enabled

  result = execute :execute_script, {}, {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.



548
549
550
551
552
553
554
555
556
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 548

def find_element_by(how, what, parent = nil)
  id = if parent
         execute :find_child_element, {id: parent}, {using: how, value: what}
       else
         execute :find_element, {}, {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.



558
559
560
561
562
563
564
565
566
567
568
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 558

def find_elements_by(how, what, parent = nil)
  ids = if parent
          execute :find_child_elements, {id: parent}, {using: how, value: what}
        else
          execute :find_elements, {}, {using: how, value: what}
        end
  # see https://github.com/SeleniumHQ/selenium/issues/4555
  ids ||= []

  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.



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

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

#go_backObject

This method is 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



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

def go_back
  execute :go_back
end

#go_forwardObject

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



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

def go_forward
  execute :go_forward
end

#implicit_wait_timeout=(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.



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

def implicit_wait_timeout=(milliseconds)
  execute :implicitly_wait, {}, {ms: milliseconds}
end

#keyboardObject

This method is 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
323
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 320

def keyboard
  WebDriver.logger.deprecate 'Driver#keyboard', 'driver.action.<command>.perform'
  Keyboard.new self
end

#local_storage_item(key, value = 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.

HTML 5



194
195
196
197
198
199
200
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 194

def local_storage_item(key, value = nil)
  if value
    execute :set_local_storage_item, {}, {key: key, value: value}
  else
    execute :get_local_storage_item, key: key
  end
end

#local_storage_keysObject

This method is 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
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 206

def local_storage_keys
  execute :get_local_storage_keys
end

#local_storage_sizeObject

This method is 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/oss/bridge.rb', line 214

def local_storage_size
  execute :get_local_storage_size
end

#locationObject

This method is 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
245
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 242

def location
  obj = execute(:get_location) || {}
  Location.new obj['latitude'], obj['longitude'], obj['altitude']
end

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



460
461
462
463
464
465
466
467
468
469
470
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 460

def log(type)
  data = execute :get_log, {}, {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

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



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

def maximize_window(handle = :current)
  execute :maximize_window, window_handle: handle
end

#mouseObject

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



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

def mouse
  WebDriver.logger.deprecate 'Driver#mouse', 'driver.action.<command>.perform'
  Mouse.new self
end

#mouse_downObject

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



341
342
343
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 341

def mouse_down
  execute :mouse_down
end

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



349
350
351
352
353
354
355
356
357
358
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 349

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

  if x && y
    params[:xoffset] = x
    params[:yoffset] = y
  end

  execute :mouse_move_to, {}, params
end

#mouse_upObject

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



345
346
347
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 345

def mouse_up
  execute :mouse_up
end

#network_connectionObject

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



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

def network_connection
  execute :get_network_connection
end

#network_connection=(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.



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

def network_connection=(type)
  execute :set_network_connection, {}, {parameters: {type: type}}
end

#optionsObject

This method is 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



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

def options
  @options ||= WebDriver::Options.new(self)
end

#page_sourceObject

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



113
114
115
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 113

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



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

def quit
  execute :quit
  http.close
rescue *http.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.



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

def refresh
  execute :refresh
end

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



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

def remove_local_storage_item(key)
  execute :remove_local_storage_item, key: key
end

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



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

def remove_session_storage_item(key)
  execute :remove_session_storage_item, key: key
end

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



175
176
177
178
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 175

def reposition_window(x, y, handle = :current)
  execute :set_window_position, {window_handle: handle},
          {x: x, y: y}
end

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



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

def resize_window(width, height, handle = :current)
  execute :set_window_size, {window_handle: handle},
          {width: width,
           height: height}
end

#screen_orientationObject

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



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

def screen_orientation
  execute :get_screen_orientation
end

#screen_orientation=(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.



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

def screen_orientation=(orientation)
  execute :set_screen_orientation, {}, {orientation: orientation}
end

#screenshotObject

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



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

def screenshot
  execute :screenshot
end

#script_timeout=(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.



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

def script_timeout=(milliseconds)
  execute :set_script_timeout, {}, {ms: milliseconds}
end

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



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

def send_keys_to_active_element(key)
  execute :send_keys_to_active_element, {}, {value: key}
end

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



364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 364

def send_keys_to_element(element, keys)
  # TODO: rework file detectors before Selenium 4.0
  if @file_detector
    local_files = keys.first.split("\n").map { |key| @file_detector.call(Array(key)) }.compact
    if local_files.any?
      keys = local_files.map { |local_file| upload(local_file) }
      keys = keys.join("\n")
    end
  end

  execute :send_keys_to_element, {id: element}, {value: Array(keys)}
end

#session_capabilitiesObject

This method is 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/oss/bridge.rb', line 53

def session_capabilities
  Capabilities.json_create execute(:get_capabilities)
end

#session_storage_item(key, value = 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.



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

def session_storage_item(key, value = nil)
  if value
    execute :set_session_storage_item, {}, {key: key, value: value}
  else
    execute :get_session_storage_item, key: key
  end
end

#session_storage_keysObject

This method is 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/oss/bridge.rb', line 230

def session_storage_keys
  execute :get_session_storage_keys
end

#session_storage_sizeObject

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



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

def session_storage_size
  execute :get_session_storage_size
end

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



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

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



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

def status
  execute :status
end

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



390
391
392
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 390

def submit_element(element)
  execute :submit_element, id: element
end

#switch_to_default_contentObject

This method is 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/oss/bridge.rb', line 129

def switch_to_default_content
  switch_to_frame(nil)
end

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



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

def switch_to_frame(id)
  execute :switch_to_frame, {}, {id: id}
end

#switch_to_parent_frameObject

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



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

def switch_to_parent_frame
  execute :switch_to_parent_frame
end

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



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

def switch_to_window(name)
  execute :switch_to_window, {}, {name: name}
end

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



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

def timeout(type, milliseconds)
  execute :set_timeout, {}, {type: type, ms: milliseconds}
end

#titleObject

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



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

def title
  execute :get_title
end

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



402
403
404
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 402

def touch_double_tap(element)
  execute :touch_double_tap, {}, {element: element}
end

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



410
411
412
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 410

def touch_down(x, y)
  execute :touch_down, {}, {x: x, y: y}
end

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



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

def touch_element_flick(element, right_by, down_by, speed)
  execute :touch_flick, {}, {element: element,
                             xoffset: right_by,
                             yoffset: down_by,
                             speed: speed}
end

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



432
433
434
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 432

def touch_flick(xspeed, yspeed)
  execute :touch_flick, {}, {xspeed: xspeed, yspeed: yspeed}
end

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



406
407
408
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 406

def touch_long_press(element)
  execute :touch_long_press, {}, {element: element}
end

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



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

def touch_move(x, y)
  execute :touch_move, {}, {x: x, y: y}
end

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



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

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

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



398
399
400
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 398

def touch_single_tap(element)
  execute :touch_single_tap, {}, {element: element}
end

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



414
415
416
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 414

def touch_up(x, y)
  execute :touch_up, {}, {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.



377
378
379
380
381
382
383
384
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 377

def upload(local_file)
  unless File.file?(local_file)
    WebDriver.logger.debug("File detector only works with files. #{local_file.inspect} isn`t a file!")
    raise Error::WebDriverError, "You are trying to work with something that isn't a file."
  end

  execute :upload_file, {}, {file: Zipper.zip_file(local_file)}
end

#urlObject

This method is 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
# File 'lib/selenium/webdriver/remote/oss/bridge.rb', line 105

def url
  execute :get_current_url
end

#window_handleObject

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



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

def window_handle
  execute :get_current_window_handle
end

#window_handlesObject

This method is 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



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

def window_handles
  execute :get_window_handles
end

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



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

def window_position(handle = :current)
  data = execute :get_window_position, window_handle: handle

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

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



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

def window_size(handle = :current)
  data = execute :get_window_size, window_handle: handle

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