VSCODE:没有调试适配器,无法发送“变量" [英] VSCODE: No debug adapter, can not send 'variables'"
问题描述
我开始使用 pupeteer 和 node,并在 win 10 中使用 vscode.我正在尝试登录一个站点并抓取一张表.到目前为止,我有:
I'm getting started with pupeteer and node and using vscode in win 10. I'm trying to log into a site and scrape a table. So far I have:
(async () => {
const browser = await puppeteer.launch({
headless: false,
});
var page = await browser.newPage();
await page.goto('thesite.com/login/');
await page.click(USERNAME_SELECTOR);
await page.keyboard.type(CREDS.username);
await page.click(PASSWORD_SELECTOR);
await page.keyboard.type(CREDS.password);
await page.click(BUTTON_SELECTOR);
await page.waitForNavigation();
const TABLE_ROW_SELECTOR = '.gv-container.gv-container-133 > table > tbody';
await page.waitForSelector(TABLE_ROW_SELECTOR);
await page.waitForSelector(TABLE_ROW_SELECTOR);
await page.screenshot({ path: 'example.png' });
const data = await page.evaluate(SELECTOR => document.querySelectorAll(SELECTOR), TABLE_ROW_SELECTOR);
await browser.close();
})();
这主要是有效的.但是在我的控制台中,我看到了一个对象列表,但据我所知,没有任何值.这是最重要的对象:
This is mostly working. however in my console I see a list of objects but as far as I can tell no values. Heres the fiest object:
0:Object {}
__proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
__defineGetter__:function __defineGetter__() { … }
__defineSetter__:function __defineSetter__() { … }
__lookupGetter__:function __lookupGetter__() { … }
__lookupSetter__:function __lookupSetter__() { … }
constructor:function Object() { … }
hasOwnProperty:function hasOwnProperty() { … }
No debug adapter, can not send 'variables'
isPrototypeOf:function isPrototypeOf() { … }
No debug adapter, can not send 'variables'
没有调试适配器,不能发送‘变量’"是什么意思?
What does " No debug adapter, can not send 'variables'" mean?
我更新到最新的 vscode 并检查所有扩展是否已更新.现在当我运行启动程序
I updated to the latest vscode and checked that all extensions were updated. Now when I run LAUNCH PROGRAM
E:\nodejs\node.exe --inspect-brk=27108 index.js
Debugger listening on ws://127.0.0.1:27108/e5928c71-370c- 4111-9ec3-77bb2cd85075
For help, see: https://nodejs.org/en/docs/inspector
(node:12844) ExperimentalWarning: The fs.promises API is experimental
warning.js:18
Array(25) [ElementHandle, ElementHandle, ElementHandle, ElementHandle, ElementHandle, ElementHandle, ElementHandle, ElementHandle, …]
index.js:64
length:25
__proto__:Array(0) [, …]
concat:function concat() { … }
[[Scopes]]:Scopes[0]
arguments:TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
知道这是什么意思吗?
推荐答案
我在尝试使用 integratedConsole
而不是 integratedTerminal
或 externalTerminal<时遇到了这个问题/code> 作为我在
launch.json
中的 Node 配置的一部分:
I had this issue when trying to use the integratedConsole
rather than integratedTerminal
or externalTerminal
as part of my Node configuration within launch.json
:
将其设置回:
"console": "integratedTerminal"
修复了它.只花了一个小时就搞清楚了.有关详细信息,请参阅文档.
Fixed it. Only took an hour to figure out. See docs for more information.
这篇关于VSCODE:没有调试适配器,无法发送“变量"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!