Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vittorio-nardone/selenium-chromium-lambda
λ How to run automated (Selenium) headless Chromium in AWS Lambda
https://github.com/vittorio-nardone/selenium-chromium-lambda
Last synced: about 1 month ago
JSON representation
λ How to run automated (Selenium) headless Chromium in AWS Lambda
- Host: GitHub
- URL: https://github.com/vittorio-nardone/selenium-chromium-lambda
- Owner: vittorio-nardone
- License: gpl-3.0
- Created: 2020-04-27T20:55:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-23T23:27:11.000Z (over 3 years ago)
- Last Synced: 2024-08-02T06:14:27.121Z (4 months ago)
- Language: Python
- Homepage:
- Size: 61.8 MB
- Stars: 90
- Watchers: 1
- Forks: 47
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-layers - `vittorio-nardone/selenium-chromium-lambda`
README
# λ selenium-chromium-lambda
How to run automated (Selenium) Headless Chromium in AWS Lambda.
Read full article [https://www.vittorionardone.it/en/2020/06/04/chromium-and-selenium-in-aws-lambda](https://www.vittorionardone.it/en/2020/06/04/chromium-and-selenium-in-aws-lambda)
An example about taking a full height screenshot of a given webpage in Python.
## BINARIES UPDATE
I’ve updated project to successfully use:
- Chromium 86.0.4240.0
- Chromedriver 86.0.4240.22.0
- Selenium 3.14## LAYERS - NEW!
A Lambda Layer is used to include all required binaries and libs.
## Contents
Selenium wrapper to get a full height screenshot of a given webpage. Code is in `src/webdriver_screenshot.py`.
Lambda source code is in `src/lambda_function.py`. It's a sample function using wrapper to get screenshot of a given URL. Fixed size and full height size screenshots are saved to a S3 bucket.
CloudFormation template to create Lambda stack. Please change `WebSite` parameter to your favorite URL.
## Commands
Run these commands in sequence:
`make lambda-layer-build` to prepare archive for AWS Lambda Layer deploy (layer.zip)
`make lambda-function-build` to prepare archive for AWS Lambda deploy (deploy.zip)
`make BUCKET= create-stack` to create CloudFormation stack (lambda function, layer and IAM role)
## Offline execution (using Docker)
`make docker-build` to prepare Docker image for AWS Lambda offline execution
`make lambda-run` to execute AWS Lambda in Docker
## Credits
Inspired by [this awesome project](https://github.com/21Buttons/pychromeless)