Class: Selenium::WebDriver::BiDi::Session
- Inherits:
-
Object
- Object
- Selenium::WebDriver::BiDi::Session
- Defined in:
- lib/selenium/webdriver/bidi/session.rb
Defined Under Namespace
Classes: Status
Instance Method Summary collapse
-
#initialize(bidi) ⇒ Session
constructor
A new instance of Session.
- #status ⇒ Object
- #subscribe(events, browsing_contexts = nil) ⇒ Object
- #unsubscribe(events, browsing_contexts = nil) ⇒ Object
Constructor Details
#initialize(bidi) ⇒ Session
Returns a new instance of Session.
26 27 28 |
# File 'lib/selenium/webdriver/bidi/session.rb', line 26 def initialize(bidi) @bidi = bidi end |
Instance Method Details
#status ⇒ Object
30 31 32 33 |
# File 'lib/selenium/webdriver/bidi/session.rb', line 30 def status status = @bidi.send_cmd('session.status') Status.new(**status) end |
#subscribe(events, browsing_contexts = nil) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/selenium/webdriver/bidi/session.rb', line 35 def subscribe(events, browsing_contexts = nil) opts = {events: Array(events)} opts[:browsing_contexts] = Array(browsing_contexts) if browsing_contexts @bidi.send_cmd('session.subscribe', **opts) end |
#unsubscribe(events, browsing_contexts = nil) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/selenium/webdriver/bidi/session.rb', line 42 def unsubscribe(events, browsing_contexts = nil) opts = {events: Array(events)} opts[:browsing_contexts] = Array(browsing_contexts) if browsing_contexts @bidi.send_cmd('session.unsubscribe', **opts) end |