Javascript 在木偶戏中,改变可解释的路径是行不通的
我刚刚搜索了木偶演员的资料。 但问题是,甚至当我将ExubablePath改为安装chrome时。 每当我启动木偶演员而不是google chrome时,chrome窗口都会保持打开状态 代码如下:Javascript 在木偶戏中,改变可解释的路径是行不通的,javascript,puppeteer,Javascript,Puppeteer,我刚刚搜索了木偶演员的资料。 但问题是,甚至当我将ExubablePath改为安装chrome时。 每当我启动木偶演员而不是google chrome时,chrome窗口都会保持打开状态 代码如下: const puppeteer = require("puppeteer"); (async () => { const browser = await puppeteer.launch({headless:false,executablePath:'C:/Pr
const puppeteer = require("puppeteer");
(async () => {
const browser = await puppeteer.launch({headless:false,executablePath:'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe'});
const page = await browser.newPage();
await page.setViewport({
width: 1280,
height: 800
});
await page.goto("https://www.the-qrcode-generator.com/",{waitUntil: 'load', timeout: 0});
await page.screenshot({
path: 'test.png',
fullPage: true
});
await browser.close();
})();
它可能与您的路径有关。但是,您也可以使用broswerFetche获取任何版本的chrome或firefox
const browserFetcher=puppeter.createBrowserFetcher();
const revisionInfo=await browserFetcher.download('533271');
const browser=wait puppeter.launch({executablePath:revisionInfo.executablePath})
实际上,我只是想让它使用我的谷歌账户登录到网上,而不是下载另一个版本的chrome@MinhLêPhanCông您是否尝试使用节点包的路径?()