Closed BrunoQuaresma closed 3 years ago
Debugging chromium.executablePath
I see its value is null
const path = await chromium.executablePath;
console.dir(path);
Hi @BrunoQuaresma - yes, it's null
because the package didn't detect it's running on a serverless environment:
See also https://github.com/alixaxel/chrome-aws-lambda/wiki/HOWTO:-Local-Development
I see, srry by the dummy question and thanks for the guidance.
@BrunoQuaresma did you end up solving this? The example in the local dev wiki is for puppeteer
, but it doesn't seem like playwright has a getter function
I gave up on doing this myself and I started to use this service https://www.browserless.io/
In .env file I added AWS_LAMBDA_FUNCTION_NAME=your functionName and It works. I can able to run the test test is passing all the way same as puppeteer with almost same timing. but, headed mode is not working. Even If I set headless: false in browser launch. Not sure why?
@BrunoQuaresma did you end up solving this? The example in the local dev wiki is for
puppeteer
, but it doesn't seem like playwright has a getter function
@BrunoQuaresma I end up doing this. It does not looks good to have import inside else but, for me this one was the only solution at that time. Install "@playwright/test" as a dev dependency so, it does not download in lambda so no problem with memory and in lambda you can use headless mode only. In local development you can use headed and headless mode.
const lambdaPlaywright = require('playwright-aws-lambda');
if (headless) {
browser = await lambdaPlaywright.launchChromium({ headless });
} else {
const regularPlaywright = require('@playwright/test');
browser = await regularPlaywright.chromium.launch({
headless,
});
}
When I use it with playwright-core 1.8.0 and I'm getting this error:
Code: