playwright-chromium
Advanced tools
Comparing version
13
index.js
@@ -16,10 +16,15 @@ /** | ||
*/ | ||
const path = require('path'); | ||
const {Playwright} = require('playwright-core/lib/server/playwright.js'); | ||
module.exports = new Playwright({ | ||
downloadPath: __dirname, | ||
const playwright = new Playwright({ | ||
browsers: ['chromium'], | ||
respectEnvironmentVariables: true, | ||
}); | ||
module.exports = playwright; | ||
try { | ||
const downloadedBrowsers = require('./.downloaded-browsers.json'); | ||
playwright.chromium._executablePath = downloadedBrowsers.crExecutablePath; | ||
} catch (e) { | ||
throw new Error('playwright-chromium has not downloaded Chromium.'); | ||
} |
@@ -16,4 +16,8 @@ /** | ||
*/ | ||
const {downloadBrowser} = require('playwright-core/download-browser'); | ||
const playwright = require('.'); | ||
downloadBrowser(playwright.chromium); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const {downloadBrowserWithProgressBar} = require('playwright-core/download-browser'); | ||
(async function() { | ||
const crExecutablePath = await downloadBrowserWithProgressBar(path.join(__dirname, '.local-browsers', 'chromium'), 'chromium'); | ||
await fs.promises.writeFile(path.join(__dirname, '.downloaded-browsers.json'), JSON.stringify({crExecutablePath})); | ||
})(); |
{ | ||
"name": "playwright-chromium", | ||
"version": "0.11.1-next.1584577781703", | ||
"version": "0.11.1-next.1584644386005", | ||
"description": "A high-level API to automate Chromium", | ||
@@ -15,4 +15,4 @@ "repository": "github:Microsoft/playwright", | ||
"dependencies": { | ||
"playwright-core": "=0.11.1-next.1584577781703" | ||
"playwright-core": "=0.11.1-next.1584644386005" | ||
} | ||
} |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2627
24.03%49
25.64%2
100%