Retrieving call frames from inside iframe
See original GitHub issueI’m trying to retrieve call frames from a script that is embedded inside an iframe. How would I do this? I’m trying to debug hcaptcha on https://www.epicgames.com/id/login/epic
const CDP = require('chrome-remote-interface');
CDP(async (client) => {
try {
const {Debugger, Page, Runtime} = client;
// enable debugger domain
await Debugger.enable();
await Runtime.enable();
Debugger.paused(async({asyncStackTrace, callFrames}) => {
//console.log(`PAUSED at line ${callFrames[0].location.lineNumber + 1}`); // (zero-based)
try {
//console.log(callFrames[0].scopeChain[0].object);
//var tg = promise
var frame = callFrames[0];
var local = await Runtime.getProperties(callFrames[0].scopeChain[0].object);
var localScope = local["result"];
localScope.forEach(element => {
console.log(element)
});
var result = {
"frame": frame,
"scope": localScope,
}
console.log(JSON.stringify(result));
} catch (e) {
console.log(e)
}
});
} catch (err) {
console.error(err);
}
}).on('error', (err) => {
console.error(err);
});
If you login once, you should see new scripts get loaded which are hcaptcha, but when I breakpoint it doesn’t output anything. My guess is that it is due to the iframe. Is there any solution? Apologies if this is worded badly, it’s very late.
Component | Version |
---|---|
Operating system | Windows 10 |
Node.js | 14.18.0 |
Chrome/Chromium/… | Chrome 96.0.4664.45 |
chrome-remote-interface | 0.31.1 |
Is Chrome running in a container? NO
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
javascript - Get element from within an iFrame - Stack Overflow
The trick here is jQuery's .contents() method, unlike .children() which can only get HTML elements, .contents() can get both text nodes and HTML ......
Read more >Working with iframes in Cypress
Application with iframe · Clicking on a button inside the iframe · Slow-loading frames · Custom command · Spying on window.fetch · Ajax...
Read more >HTMLIFrameElement.contentWindow - Web APIs | MDN
The contentWindow property returns the Window object of an HTMLIFrameElement. You can use this Window object to access the iframe's document ...
Read more >How to handle iFrame in Selenium - BrowserStack
Learn how to handle iframe in Selenium with the SwitchTo() method to switch between frames along with code samples.
Read more >Cannot get element inside Iframe. · Issue #6 · go-rod ... - GitHub
I see people encounter similar issues all the time. Such as when an iframe is inside another iframe you need to call Frame()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK the reason why your scenario doesn’t get handled really escapes me; I cannot reproduce it in a standalone PoC, I tried several things, including creating the frame dynamically, etc. It feels like a Chrome bug honestly…
Anyway, you can try this workaround:
Basically, for each discovered target creates another instance in which it performs the logic, i.e., dumping the stack frames. This shouldn’t be needed but still…
Awesome! If you ever come up with a minimal PoC that reproduces this issue, feel free to post it here.