Support for Playwright running on AWS Lambda and Google Cloud Functions.
NOTE: Currently only Chromium is supported.
npm install playwright-core playwright-aws-lambda --save
This package works with the nodejs10.x
, nodejs12.x
and nodejs14.x
AWS Lambda runtimesout of the box.
const playwright = require('playwright-aws-lambda');
exports.handler = async (event, context) => {
let browser = null;
try {
const browser = await playwright.launchChromium();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(event.url || 'https://example.com');
console.log('Page title: ', await page.title());
} catch (error) {
throw error;
} finally {
if (browser) {
await browser.close();
}
}
};
Method / Property | Returns | Description |
---|---|---|
launchChromium |
{!Promise<playwright.ChromiumBrowser>} |
Launches the Chromium browser. |
loadFont(url) |
{Promise<void>} |
Downloads and activates a custom font |
If you need custom font support by e.g. emojicons in your browser, you have toload it by using the loadFont(url: string)
function before you launch thebrowser.
await loadFont(
'https://raw.githack.com/googlei18n/noto-emoji/master/fonts/NotoColorEmoji.ttf'
);
This project is based on the work ofchrome-aws-lambda.
Playwright 是一个 Node.js 库,可使用单个 API 自动化 Chromium、Firefox 和 WebKit。Playwright 的建立是为了实现跨浏览器的网络自动化。 Playwright 是为自动化单页应用和渐进式 Web 应用所使用的广泛和不断增长的 Web 浏览器功能而建立的。 跨越多个页面、域和 iframe 的场景 在执行操作(如单击、填充)之前自动等待元素准备就
Playwright for .NET �� Linux macOS Windows Chromium 94.0.4595.0 ✅ ✅ ✅ WebKit 15.0 ✅ ✅ ✅ Firefox 91.0 ✅ ✅ ✅ Playwright for .NET is the official language port of Playwright, the library to automate Chro
�� Playwright for Feedback for future development of this project is needed, see here. Thanks! API reference | Example recipes Playwright is a Go library to automate Chromium, Firefox and WebKit with
我想在向url发送请求时添加假用户代理。但它并没有添加假useragent,而是使用默认的useragent。
使用微软的剧作家,我有这个测试代码,工作: 我想把它分解成一个页面对象。我把它作为我的页面对象 作为我的测试: 但我明白了 这是为什么呢? 注意:如果需要的话,在节点16中使用本地es模块
我目前正在使用playright/Python/Pytest,我正在尝试将用户登录作为特定类型的用户角色,然后检查各种按钮是否可见或隐藏。 我正在使用页面对象,并为每个按钮元素设置了属性,即。 然后我使用一个验证方法的可见按钮: 这可以很好地工作,并将测试中的断言传递回true。 然后,我尝试使用以下方法对隐藏值执行相同操作: 但是我得到了这个错误——等待选择器“xpath=//h3[normal