Skip to content

Commit 30dc70f

Browse files
author
Austin Kelleher
committed
Update README
1 parent b8b0ea7 commit 30dc70f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
11
# playwright-aws-lambda
2+
3+
Support for PlayWright running on AWS Lambda and Google Cloud Functions
4+
5+
## Install
6+
7+
```shell
8+
npm install playwrite-core playwright-aws-lambda --save
9+
```
10+
11+
## Usage
12+
13+
This package works with the `nodejs8.10`, `nodejs10.x` and `nodejs12.x` AWS
14+
Lambda runtimes out of the box.
15+
16+
```javascript
17+
const playwright = require('playwright-aws-lambda');
18+
19+
exports.handler = async (event, context) => {
20+
let result = null;
21+
let browser = null;
22+
23+
try {
24+
const browser = await playwright.launchChromium();
25+
const context = await browser.defaultContext();
26+
27+
const page = await context.newPage();
28+
await page.goto(event.url || 'https://example.com');
29+
30+
console.log('Page title: ', await page.title());
31+
} catch (error) {
32+
throw err;
33+
} finally {
34+
if (browser !== null) {
35+
await browser.close();
36+
}
37+
}
38+
};
39+
```
40+
41+
## Thanks / Credits
42+
43+
This project is based on the work of
44+
[chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda).

0 commit comments

Comments
 (0)