Class: Selenium::DevTools::V130::DOMStorage
- Inherits:
-
Object
- Object
- Selenium::DevTools::V130::DOMStorage
- Defined in:
- lib/selenium/devtools/v130/dom_storage.rb
Constant Summary collapse
- EVENTS =
{ dom_storage_item_added: 'domStorageItemAdded', dom_storage_item_removed: 'domStorageItemRemoved', dom_storage_item_updated: 'domStorageItemUpdated', dom_storage_items_cleared: 'domStorageItemsCleared', }.freeze
Instance Method Summary collapse
- #clear(storage_id:) ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #get_dom_storage_items(storage_id:) ⇒ Object
-
#initialize(devtools) ⇒ DOMStorage
constructor
A new instance of DOMStorage.
- #on(event, &block) ⇒ Object
- #remove_dom_storage_item(storage_id:, key:) ⇒ Object
- #set_dom_storage_item(storage_id:, key:, value:) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ DOMStorage
Returns a new instance of DOMStorage.
32 33 34 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 32 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#clear(storage_id:) ⇒ Object
41 42 43 44 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 41 def clear(storage_id:) @devtools.send_cmd('DOMStorage.clear', storageId: storage_id) end |
#disable ⇒ Object
46 47 48 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 46 def disable @devtools.send_cmd('DOMStorage.disable') end |
#enable ⇒ Object
50 51 52 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 50 def enable @devtools.send_cmd('DOMStorage.enable') end |
#get_dom_storage_items(storage_id:) ⇒ Object
54 55 56 57 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 54 def get_dom_storage_items(storage_id:) @devtools.send_cmd('DOMStorage.getDOMStorageItems', storageId: storage_id) end |
#on(event, &block) ⇒ Object
36 37 38 39 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 36 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["DOMStorage.#{event}"] << block end |
#remove_dom_storage_item(storage_id:, key:) ⇒ Object
59 60 61 62 63 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 59 def remove_dom_storage_item(storage_id:, key:) @devtools.send_cmd('DOMStorage.removeDOMStorageItem', storageId: storage_id, key: key) end |
#set_dom_storage_item(storage_id:, key:, value:) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/selenium/devtools/v130/dom_storage.rb', line 65 def set_dom_storage_item(storage_id:, key:, value:) @devtools.send_cmd('DOMStorage.setDOMStorageItem', storageId: storage_id, key: key, value: value) end |