Extensions#

Defines commands and events for browser extensions.

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 StorageArea(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Storage areas.

SESSION = 'session'#
LOCAL = 'local'#
SYNC = 'sync'#
MANAGED = 'managed'#

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.

clear_storage_items(id_, storage_area)[source]#

Clears extension storage in the given storageArea.

Parameters:
  • id – ID of extension.

  • storage_area (StorageArea) – StorageArea to remove data from.

Return type:

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

get_storage_items(id_, storage_area, keys=None)[source]#

Gets data from extension storage in the given storageArea. If keys is specified, these are used to filter the result.

Parameters:
  • id – ID of extension.

  • storage_area (StorageArea) – StorageArea to retrieve data from.

  • keys (Optional[List[str]]) – (Optional) Keys to retrieve.

Return type:

Generator[Dict[str, Any], Dict[str, Any], dict]

Returns:

load_unpacked(path)[source]#

Installs an unpacked extension from the filesystem similar to –load-extension CLI flags. Returns extension ID once the extension has been installed. Available if the client is connected using the –remote-debugging-pipe flag and the –enable-unsafe-extension-debugging flag is set.

Parameters:

path (str) – Absolute file path.

Return type:

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

Returns:

Extension id.

remove_storage_items(id_, storage_area, keys)[source]#

Removes keys from extension storage in the given storageArea.

Parameters:
  • id – ID of extension.

  • storage_area (StorageArea) – StorageArea to remove data from.

  • keys (List[str]) – Keys to remove.

Return type:

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

set_storage_items(id_, storage_area, values)[source]#

Sets values in extension storage in the given storageArea. The provided values will be merged with existing values in the storage area.

Parameters:
  • id – ID of extension.

  • storage_area (StorageArea) – StorageArea to set data in.

  • values (dict) – Values to set.

Return type:

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

uninstall(id_)[source]#

Uninstalls an unpacked extension (others not supported) from the profile. Available if the client is connected using the –remote-debugging-pipe flag and the –enable-unsafe-extension-debugging.

Parameters:

id – Extension id.

Return type:

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

Events#

There are no events in this module.