Class: Selenium::DevTools::V130::BackgroundService
- Inherits:
-
Object
- Object
- Selenium::DevTools::V130::BackgroundService
- Defined in:
- lib/selenium/devtools/v130/background_service.rb
Constant Summary collapse
- EVENTS =
{ recording_state_changed: 'recordingStateChanged', background_service_event_received: 'backgroundServiceEventReceived', }.freeze
Instance Method Summary collapse
- #clear_events(service:) ⇒ Object
-
#initialize(devtools) ⇒ BackgroundService
constructor
A new instance of BackgroundService.
- #on(event, &block) ⇒ Object
- #set_recording(should_record:, service:) ⇒ Object
- #start_observing(service:) ⇒ Object
- #stop_observing(service:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ BackgroundService
Returns a new instance of BackgroundService.
30 31 32 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 30 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#clear_events(service:) ⇒ Object
55 56 57 58 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 55 def clear_events(service:) @devtools.send_cmd('BackgroundService.clearEvents', service: service) end |
#on(event, &block) ⇒ Object
34 35 36 37 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 34 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["BackgroundService.#{event}"] << block end |
#set_recording(should_record:, service:) ⇒ Object
49 50 51 52 53 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 49 def set_recording(should_record:, service:) @devtools.send_cmd('BackgroundService.setRecording', shouldRecord: should_record, service: service) end |
#start_observing(service:) ⇒ Object
39 40 41 42 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 39 def start_observing(service:) @devtools.send_cmd('BackgroundService.startObserving', service: service) end |
#stop_observing(service:) ⇒ Object
44 45 46 47 |
# File 'lib/selenium/devtools/v130/background_service.rb', line 44 def stop_observing(service:) @devtools.send_cmd('BackgroundService.stopObserving', service: service) end |