Class: Selenium::DevTools::V85::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/storage.rb

Constant Summary collapse

EVENTS =
{
  cache_storage_content_updated: 'cacheStorageContentUpdated',
  cache_storage_list_updated: 'cacheStorageListUpdated',
  indexed_db_content_updated: 'indexedDBContentUpdated',
  indexed_db_list_updated: 'indexedDBListUpdated',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ Storage

Returns a new instance of Storage.



32
33
34
# File 'lib/selenium/devtools/v85/storage.rb', line 32

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#clear_cookies(browser_context_id: nil) ⇒ Object



58
59
60
61
# File 'lib/selenium/devtools/v85/storage.rb', line 58

def clear_cookies(browser_context_id: nil)
  @devtools.send_cmd('Storage.clearCookies',
                     browserContextId: browser_context_id)
end

#clear_data_for_origin(origin:, storage_types:) ⇒ Object



41
42
43
44
45
# File 'lib/selenium/devtools/v85/storage.rb', line 41

def clear_data_for_origin(origin:, storage_types:)
  @devtools.send_cmd('Storage.clearDataForOrigin',
                     origin: origin,
                     storageTypes: storage_types)
end

#get_cookies(browser_context_id: nil) ⇒ Object



47
48
49
50
# File 'lib/selenium/devtools/v85/storage.rb', line 47

def get_cookies(browser_context_id: nil)
  @devtools.send_cmd('Storage.getCookies',
                     browserContextId: browser_context_id)
end

#get_usage_and_quota(origin:) ⇒ Object



63
64
65
66
# File 'lib/selenium/devtools/v85/storage.rb', line 63

def get_usage_and_quota(origin:)
  @devtools.send_cmd('Storage.getUsageAndQuota',
                     origin: origin)
end

#on(event, &block) ⇒ Object



36
37
38
39
# File 'lib/selenium/devtools/v85/storage.rb', line 36

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["Storage.#{event}"] << block
end

#set_cookies(cookies:, browser_context_id: nil) ⇒ Object



52
53
54
55
56
# File 'lib/selenium/devtools/v85/storage.rb', line 52

def set_cookies(cookies:, browser_context_id: nil)
  @devtools.send_cmd('Storage.setCookies',
                     cookies: cookies,
                     browserContextId: browser_context_id)
end

#track_cache_storage_for_origin(origin:) ⇒ Object



68
69
70
71
# File 'lib/selenium/devtools/v85/storage.rb', line 68

def track_cache_storage_for_origin(origin:)
  @devtools.send_cmd('Storage.trackCacheStorageForOrigin',
                     origin: origin)
end

#track_indexed_db_for_origin(origin:) ⇒ Object



73
74
75
76
# File 'lib/selenium/devtools/v85/storage.rb', line 73

def track_indexed_db_for_origin(origin:)
  @devtools.send_cmd('Storage.trackIndexedDBForOrigin',
                     origin: origin)
end

#untrack_cache_storage_for_origin(origin:) ⇒ Object



78
79
80
81
# File 'lib/selenium/devtools/v85/storage.rb', line 78

def untrack_cache_storage_for_origin(origin:)
  @devtools.send_cmd('Storage.untrackCacheStorageForOrigin',
                     origin: origin)
end

#untrack_indexed_db_for_origin(origin:) ⇒ Object



83
84
85
86
# File 'lib/selenium/devtools/v85/storage.rb', line 83

def untrack_indexed_db_for_origin(origin:)
  @devtools.send_cmd('Storage.untrackIndexedDBForOrigin',
                     origin: origin)
end