-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDPSession problem - no clean way to remove and add event listeners using results from DOMDebugger.getEventListeners #5319
Comments
The failure here is pilot error - wHandle is a struct with a single member 'result', which contains the expected contents... however... the problem now morphs into a feature request - I need to take the resulting items and use them in removeEventListener() and addEventListener() calls - the API has methods to add and remove event breakpoints, but not the listeners themselves. What I'm trying to implement is the equivalent of these two methods (again, see issue 5300 - this is an attempted work-around to viewport problems in doing a full-page capture) The plan here is to do something like... setViewport (real size) __killResizeEvents() ==================
// console.log("removing event handler " + i);
} function __restoreResizeEvents(eventArray) =========== but.. that still doesn't give me something I can call removeEventListener() or addEventListener() with. |
Hi @timparker183. Did you find a solution to your issue? |
We're marking this issue as unconfirmed because it has not had recent activity and we weren't able to confirm it yet. It will be closed if no further activity occurs within the next 30 days. |
We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it! |
Steps to reproduce
Tell us about your environment:
What steps will reproduce the problem?
browser = await chromium.puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless
});
let page = await browser.newPage();
let viewportSize = {width: 1920, height: 1080};
await page.setViewport(viewportSize);
let result= await page.goto('https://www.dpreview.com/archive/2019/12',{timeout:30000,waitUntil:'networkidle0'});
let client = await page.target().createCDPSession();
let wHandle = await client.send("Runtime.evaluate", {expression: "window"});
console.log(wHandle);
let listeners = await client.send("DOMDebugger.getEventListeners", {objectId:wHandle.objectId});
console.log(listeners);
What is the expected result?
I expect to get a collection of listener objects (or at least not an error - the page in the example above replaces a non-public page which has 'resize' events I need to save/kill/restore as a way of working around problems described here: #5300)
What happens instead?
DOMDebugger.getEventListeners call results in an error:
Protocol error (DOMDebugger.getEventListeners): Invalid parameters objectId: string value expected
The text was updated successfully, but these errors were encountered: