IndexedDB

This CDP domain is experimental.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.indexed_db.DatabaseWithObjectStores(name, version, object_stores)

Database with an array of object stores.

name = None

Database name.

object_stores = None

Object stores in this database.

version = None

Database version (type is not ‘integer’, as the standard requires the version number to be ‘unsigned long long’)

class cdp.indexed_db.ObjectStore(name, key_path, auto_increment, indexes)

Object store.

auto_increment = None

If true, object store has auto increment flag set.

indexes = None

Indexes in this object store.

key_path = None

Object store key path.

name = None

Object store name.

class cdp.indexed_db.ObjectStoreIndex(name, key_path, unique, multi_entry)

Object store index.

key_path = None

Index key path.

multi_entry = None

If true, index allows multiple entries for a key.

name = None

Index name.

unique = None

If true, index is unique.

class cdp.indexed_db.Key(type_, number=None, string=None, date=None, array=None)

Key.

array = None

Array value.

date = None

Date value.

number = None

Number value.

string = None

String value.

type_ = None

Key type.

class cdp.indexed_db.KeyRange(lower_open, upper_open, lower=None, upper=None)

Key range.

lower = None

Lower bound.

lower_open = None

If true lower bound is open.

upper = None

Upper bound.

upper_open = None

If true upper bound is open.

class cdp.indexed_db.DataEntry(key, primary_key, value)

Data entry.

key = None

Key object.

primary_key = None

Primary key object.

value = None

Value object.

class cdp.indexed_db.KeyPath(type_, string=None, array=None)

Key path.

array = None

Array value.

string = None

String value.

type_ = None

Key path type.

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.indexed_db.clear_object_store(security_origin, database_name, object_store_name)

Clears all entries from an object store.

Parameters:
  • security_origin (str) – Security origin.
  • database_name (str) – Database name.
  • object_store_name (str) – Object store name.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.indexed_db.delete_database(security_origin, database_name)

Deletes a database.

Parameters:
  • security_origin (str) – Security origin.
  • database_name (str) – Database name.
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.indexed_db.delete_object_store_entries(security_origin, database_name, object_store_name, key_range)

Delete a range of entries from an object store

Parameters:
  • security_origin (str) –
  • database_name (str) –
  • object_store_name (str) –
  • key_range (KeyRange) – Range of entry keys to delete
Return type:

Generator[Dict[str, Any], Dict[str, Any], None]

cdp.indexed_db.disable()

Disables events from backend.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.indexed_db.enable()

Enables events from backend.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.indexed_db.get_metadata(security_origin, database_name, object_store_name)

Gets metadata of an object store

Parameters:
  • security_origin (str) – Security origin.
  • database_name (str) – Database name.
  • object_store_name (str) – Object store name.
Return type:

Generator[Dict[str, Any], Dict[str, Any], Tuple[float, float]]

Returns:

A tuple with the following items:

  1. entriesCount - the entries count
  2. keyGeneratorValue - the current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.

cdp.indexed_db.request_data(security_origin, database_name, object_store_name, index_name, skip_count, page_size, key_range=None)

Requests data from object store or index.

Parameters:
  • security_origin (str) – Security origin.
  • database_name (str) – Database name.
  • object_store_name (str) – Object store name.
  • index_name (str) – Index name, empty string for object store data requests.
  • skip_count (int) – Number of records to skip.
  • page_size (int) – Number of records to fetch.
  • key_range (Optional[KeyRange]) – (Optional) Key range.
Return type:

Generator[Dict[str, Any], Dict[str, Any], Tuple[List[DataEntry], bool]]

Returns:

A tuple with the following items:

  1. objectStoreDataEntries - Array of object store data entries.
  2. hasMore - If true, there are more entries to fetch in the given range.

cdp.indexed_db.request_database(security_origin, database_name)

Requests database with given name in given frame.

Parameters:
  • security_origin (str) – Security origin.
  • database_name (str) – Database name.
Return type:

Generator[Dict[str, Any], Dict[str, Any], DatabaseWithObjectStores]

Returns:

Database with an array of object stores.

cdp.indexed_db.request_database_names(security_origin)

Requests database names for given security origin.

Parameters:security_origin (str) – Security origin.
Return type:Generator[Dict[str, Any], Dict[str, Any], List[str]]
Returns:Database names for origin.

Events

There are no events in this module.