ServiceWorker

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.service_worker.RegistrationID
class cdp.service_worker.ServiceWorkerRegistration(registration_id, scope_url, is_deleted)

ServiceWorker registration.

class cdp.service_worker.ServiceWorkerVersionRunningStatus

An enumeration.

RUNNING = 'running'
STARTING = 'starting'
STOPPED = 'stopped'
STOPPING = 'stopping'
class cdp.service_worker.ServiceWorkerVersionStatus

An enumeration.

ACTIVATED = 'activated'
ACTIVATING = 'activating'
INSTALLED = 'installed'
INSTALLING = 'installing'
NEW = 'new'
REDUNDANT = 'redundant'
class cdp.service_worker.ServiceWorkerVersion(version_id, registration_id, script_url, running_status, status, script_last_modified=None, script_response_time=None, controlled_clients=None, target_id=None)

ServiceWorker version.

controlled_clients = None
script_last_modified = None

The Last-Modified header value of the main script.

script_response_time = None

The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.

target_id = None
class cdp.service_worker.ServiceWorkerErrorMessage(error_message, registration_id, version_id, source_url, line_number, column_number)

ServiceWorker error message.

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.service_worker.deliver_push_message(origin, registration_id, data)
Parameters:
  • origin (str) –
  • registration_id (RegistrationID) –
  • data (str) –
Return type:

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

cdp.service_worker.disable()
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.dispatch_sync_event(origin, registration_id, tag, last_chance)
Parameters:
  • origin (str) –
  • registration_id (RegistrationID) –
  • tag (str) –
  • last_chance (bool) –
Return type:

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

cdp.service_worker.enable()
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.inspect_worker(version_id)
Parameters:version_id (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.set_force_update_on_page_load(force_update_on_page_load)
Parameters:force_update_on_page_load (bool) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.skip_waiting(scope_url)
Parameters:scope_url (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.start_worker(scope_url)
Parameters:scope_url (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.stop_all_workers()
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.stop_worker(version_id)
Parameters:version_id (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.unregister(scope_url)
Parameters:scope_url (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.service_worker.update_registration(scope_url)
Parameters:scope_url (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]

Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class cdp.service_worker.WorkerErrorReported(error_message)
class cdp.service_worker.WorkerRegistrationUpdated(registrations)
class cdp.service_worker.WorkerVersionUpdated(versions)