如果单击它,我有一个按钮,它会打开一个新窗口,并且我可以访问其DOM,但是当我关闭它并想访问我的上一页做某些事情时,我会出错
Error: Node is detached from document
at ElementHandle._scrollIntoViewIfNeeded (C:\Users\user\Desktop\doc\node_modules\puppeteer\lib\ElementHandle.js:75:13)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
我的代码如下
const newPagePromise = new Promise(x => browser.once('targetcreated', target => x(target.page())));
await linkhandle[i].click();
const popup = await newPagePromise;
// some DOM hocus focus with popup DOM
popup.close();
// some DOM hocus focus with primary page which opened the popup