Class: Selenium::WebDriver::Remote::BiDiBridge Private

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

READINESS_STATE =

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.

{
  'none' => :none,
  'eager' => :interactive,
  'normal' => :complete
}.freeze

Constants inherited from Bridge

Selenium::WebDriver::Remote::Bridge::COMMANDS, Selenium::WebDriver::Remote::Bridge::PORT, Selenium::WebDriver::Remote::Bridge::QUIT_ERRORS

Instance Attribute Summary collapse

Attributes inherited from Bridge

#capabilities, #file_detector, #http

Instance Method Summary collapse

Methods inherited from Bridge

#accept_alert, #action, #active_element, add_command, #add_cookie, #add_credential, #add_virtual_authenticator, #alert=, #alert_text, #bidi?, #browser, #cancel_fedcm_dialog, #clear_element, #click_element, #click_fedcm_dialog_button, #command_list, #cookie, #cookies, #credentials, #delete_all_cookies, #delete_cookie, #dismiss_alert, #element_aria_label, #element_aria_role, #element_attribute, #element_displayed?, #element_dom_attribute, #element_enabled?, #element_location, #element_location_once_scrolled_into_view, #element_property, #element_rect, #element_screenshot, #element_selected?, #element_size, #element_tag_name, #element_text, #element_value, #element_value_of_css_property, #execute_async_script, #execute_script, #fedcm_account_list, #fedcm_delay, #fedcm_dialog_type, #fedcm_subtitle, #fedcm_title, #find_element_by, #find_elements_by, #full_screen_window, #initialize, #manage, #maximize_window, #minimize_window, #new_window, #page_source, #print_page, #release_actions, #remove_all_credentials, #remove_credential, #remove_virtual_authenticator, #reposition_window, #reset_fedcm_cooldown, #resize_window, #screenshot, #select_fedcm_account, #send_actions, #send_keys_to_element, #session_id, #set_window_rect, #shadow_root, #status, #submit_element, #switch_to_default_content, #switch_to_frame, #switch_to_parent_frame, #switch_to_window, #timeouts, #timeouts=, #title, #url, #user_verified, #window_handle, #window_handles, #window_position, #window_rect, #window_size

Methods included from Atoms

#atom_script

Constructor Details

This class inherits a constructor from Selenium::WebDriver::Remote::Bridge

Instance Attribute Details

#bidi ⇒ Object (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.



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

def bidi
  @bidi
end

#connection ⇒ Object (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.



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

def connection
  @connection
end

Instance Method Details

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



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

def close
  execute(:close_window).tap { |handles| bidi.close if handles.empty? }
end

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



36
37
38
39
40
41
42
43
44
45
46
47
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 36

def create_session(capabilities)
  super

  begin
    @bidi = Selenium::WebDriver::BiDi.new(url: validated_socket_url)
    # Reuse the BiDi object's socket as the connection until the bridge owns it directly.
    @connection = @bidi.ws
  rescue StandardError
    quit
    raise
  end
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.



59
60
61
62
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 59

def get(url)
  browsing_context.navigate(context: window_handle, url: url, wait: readiness_state)
  nil
end

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



64
65
66
67
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 64

def go_back
  browsing_context.traverse_history(context: window_handle, delta: -1)
  nil
end

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



69
70
71
72
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 69

def go_forward
  browsing_context.traverse_history(context: window_handle, delta: 1)
  nil
end

#install_web_extension(path) ⇒ 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
52
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 49

def install_web_extension(path)
  result = web_extension.install(extension_data: web_extension_data(path))
  WebExtension.new(result.extension)
end

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



79
80
81
82
83
84
85
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 79

def quit
  bidi&.close
rescue *QUIT_ERRORS
  nil
ensure
  super
end

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



74
75
76
77
# File 'rb/lib/selenium/webdriver/remote/bidi_bridge.rb', line 74

def refresh
  browsing_context.reload(context: window_handle, wait: readiness_state)
  nil
end

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



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

def uninstall_web_extension(id)
  web_extension.uninstall(extension: id)
  nil
end