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

Inherits:
Bridge
  • Object
show all
Defined in:
lib/selenium/webdriver/remote/bidi_bridge.rb

Constant Summary

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

#bidiObject (readonly)

Returns the value of attribute bidi.



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

def bidi
  @bidi
end

#transportObject (readonly)

Returns the value of attribute transport.



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

def transport
  @transport
end

Instance Method Details

#closeObject



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

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

#create_session(capabilities) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/selenium/webdriver/remote/bidi_bridge.rb', line 29

def create_session(capabilities)
  super
  socket_url = @capabilities[:web_socket_url]
  @bidi = Selenium::WebDriver::BiDi.new(url: socket_url)
  # Share the BiDi object's socket until the bridge owns the connection directly.
  @transport = BiDi::Transport.new(@bidi.ws)
end

#get(url) ⇒ Object



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

def get(url)
  browsing_context.navigate(url)
end

#go_backObject



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

def go_back
  browsing_context.traverse_history(-1)
end

#go_forwardObject



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

def go_forward
  browsing_context.traverse_history(1)
end

#quitObject



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

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

#refreshObject



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

def refresh
  browsing_context.reload
end