node.js 中的 SSL 证书错误
SSL Certificate error in node.js
我对木偶操作有疑问。
所以我想做的是启动一个网站并登录。但是,该网站试图加载因不安全而被阻止的资源。在 运行 代码之后我收到此错误消息并且代码停止 运行:
(node:11684) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SSL Certificate error: ERR_CERT_COMMON_NAME_INVALID
(node:11684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我的代码:
'use strict';
const puppeteer = require('puppeteer');
async function Login(username, password){
const browser = await puppeteer.launch({
headless: false
});
const page = await browser.newPage();
await page.goto('https://shop.adidas.ae/en/customer/account/login', {waitUntil: 'networkidle'});
/*await page.type(username);
await page.focus('#pass');
await page.type(password);
await page.click('#send2');*/
await browser.close();
}
Login('xxx', 'xxx');
这是 chrome 领事发布的内容:
Failed to load resource: net::ERR_INSECURE_RESPONSE
我的环境:
最新的 Puppeteer 版本 / Windows 10
设置ignoreHTTPSErrors: true
。当心:这将忽略所有 SSL 错误。
'use strict';
const puppeteer = require('puppeteer');
async function Login(username, password){
const browser = await puppeteer.launch({
headless: false,
ignoreHTTPSErrors: true
});
const page = await browser.newPage();
await page.goto('https://shop.adidas.ae/en/customer/account/login', {waitUntil: 'networkidle'});
/*await page.type(username);
await page.focus('#pass');
await page.type(password);
await page.click('#send2');*/
await browser.close();
}
Login('xxx', 'xxx');
我对木偶操作有疑问。 所以我想做的是启动一个网站并登录。但是,该网站试图加载因不安全而被阻止的资源。在 运行 代码之后我收到此错误消息并且代码停止 运行:
(node:11684) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: SSL Certificate error: ERR_CERT_COMMON_NAME_INVALID
(node:11684) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我的代码:
'use strict';
const puppeteer = require('puppeteer');
async function Login(username, password){
const browser = await puppeteer.launch({
headless: false
});
const page = await browser.newPage();
await page.goto('https://shop.adidas.ae/en/customer/account/login', {waitUntil: 'networkidle'});
/*await page.type(username);
await page.focus('#pass');
await page.type(password);
await page.click('#send2');*/
await browser.close();
}
Login('xxx', 'xxx');
这是 chrome 领事发布的内容:
Failed to load resource: net::ERR_INSECURE_RESPONSE
我的环境: 最新的 Puppeteer 版本 / Windows 10
设置ignoreHTTPSErrors: true
。当心:这将忽略所有 SSL 错误。
'use strict';
const puppeteer = require('puppeteer');
async function Login(username, password){
const browser = await puppeteer.launch({
headless: false,
ignoreHTTPSErrors: true
});
const page = await browser.newPage();
await page.goto('https://shop.adidas.ae/en/customer/account/login', {waitUntil: 'networkidle'});
/*await page.type(username);
await page.focus('#pass');
await page.type(password);
await page.click('#send2');*/
await browser.close();
}
Login('xxx', 'xxx');