Class: Selenium::WebDriver::BiDi::Session

Inherits:
Object
  • Object
show all
Defined in:
rb/lib/selenium/webdriver/bidi/session.rb

Defined Under Namespace

Classes: Status

Instance Method Summary collapse

Constructor Details

#initialize(bidi) ⇒ Session

Returns a new instance of Session.



26
27
28
# File 'rb/lib/selenium/webdriver/bidi/session.rb', line 26

def initialize(bidi)
  @bidi = bidi
end

Instance Method Details

#statusObject



30
31
32
33
# File 'rb/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 'rb/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 'rb/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