Skip to content

Uses Serverless and Chrome DevProtocol to manipulate headless Chrome in lambda.

Notifications You must be signed in to change notification settings

Nordstrom/serverless-cdp-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Serverless CDP

Chrome Debugging Protocol interface that helps to instrument Chrome (or any other suitable implementation) by providing a simple abstraction of commands and notifications using a straightforward JavaScript API.

Deployment

Install the required packages.

npm install --global serverless
npm install --save @serverless-chrome/lambda
npm install --save chrome-remote-interface

Once the packages are installed you must set your AWS credentials by defining AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environmental variables, or using an AWS profile. You can read more about this on the Serverless Credentials Guide.

In short, either:

export AWS_PROFILE=<your-profile-name>

or

export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>

Then, to deploy the service and all of its functions:

serverless deploy -v

Use this to quickly upload and overwrite your AWS Lambda code on AWS, allowing you to develop faster.

serverless deploy function -f CDP

Usage

You can easily add a target to be audited and manipulate the performance data.

Setting up a test.

By adding in some serverless configs you can create a desktop script target.

functions:
  CDP:
    handler: handler.chromeDevProto
    events:
      - schedule:
          name: cdp-script-trigger
          description: 'Run a CDP script on the input target.'
          rate: rate(5 minutes)
          enabled: true
          input:
            target: https://www.example.com/

This will create a desktop audit of "https://www.example.com/" and will run every 5 minutes.

Docs

Releases

No releases published

Packages

No packages published