Class: Selenium::WebDriver::BiDi::BrowsingContext Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rb/lib/selenium/webdriver/bidi/browsing_context.rb |
Overview
Implements the browsingContext Module of the WebDriver-BiDi specification
Constant Summary
-
READINESS_STATE =
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 28{ 'none' => 'none', 'eager' => 'interactive', 'normal' => 'complete' }.freeze
Class Method Summary
-
.new(bridge) ⇒ BrowsingContext
constructor
Internal use only
TODO: store current window handle in bridge object instead of always calling it.
Instance Method Summary
-
#close(context_id: nil)
Internal use only
Closes the browsing context.
-
#create(type: nil, context_id: nil) ⇒ String
Internal use only
Create a new browsing context.
-
#navigate(url, context_id: nil)
Internal use only
Navigates to the specified URL in the given browsing context.
-
#reload(context_id: nil, ignore_cache: false)
Internal use only
Reloads the browsing context.
-
#traverse_history(delta, context_id: nil)
Internal use only
Traverses the browsing context history by a given delta.
Constructor Details
.new(bridge) ⇒ BrowsingContext
TODO: store current window handle in bridge object instead of always calling it
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 35
def initialize(bridge) @bridge = bridge @bidi = @bridge.bidi page_load_strategy = bridge.capabilities[:page_load_strategy] @readiness = READINESS_STATE[page_load_strategy] end
Instance Method Details
#close(context_id: nil)
Closes the browsing context.
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 78
def close(context_id: nil) context_id ||= @bridge.window_handle @bidi.send_cmd('browsingContext.close', context: context_id) end
#create(type: nil, context_id: nil) ⇒ String
Create a new browsing context.
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 91
def create(type: nil, context_id: nil) type ||= :window context_id ||= @bridge.window_handle result = @bidi.send_cmd('browsingContext.create', type: type.to_s, referenceContext: context_id) result['context'] end
#reload(context_id: nil, ignore_cache: false)
Reloads the browsing context.
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 68
def reload(context_id: nil, ignore_cache: false) context_id ||= @bridge.window_handle params = {context: context_id, ignore_cache: ignore_cache, wait: @readiness} @bidi.send_cmd('browsingContext.reload', **params) end
#traverse_history(delta, context_id: nil)
Traverses the browsing context history by a given delta.
# File 'rb/lib/selenium/webdriver/bidi/browsing_context.rb', line 58
def traverse_history(delta, context_id: nil) context_id ||= @bridge.window_handle @bidi.send_cmd('browsingContext.traverseHistory', context: context_id, delta: delta) end