question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't access a frame or framesets within a frame.

See original GitHub issue
  • Puppeteer version: “puppeteer”: “^1.4.0”
  • Platform / OS version: OSX : High Sierra
  • URLs (if applicable): None
  • Node.js version: node --version v10.1.0

I need help navigating to a frame within a frame (potentially any number of levels of frames could be nested).

There seem to be a lot of issues relating to accessing frames in a page and I can’t find a clear answer to what feels like a straightforward use case.

I have a frame within a frameset within a frame within the dom. I need to fill out a form within that lower level frame. But I can’t seem to access it or change the “page” context to that sub frame even though I can access the top level frame.

Ideally perhaps something like this :

const frame = page.frames()[1];
console.log(frame.frames()) // hangs pupeteer and fails? 

I can’t change anything about the architecture of the pages right now, but my question is really that I want some more clarity about what pupeteer can and can’t do.

I would ideally like the ability to do what i described above. Just access the frame object as a subsequent page object.

Is there some documentation I’m missing because this feels straightforward. I am however working with some old technology so i’m not expecting too much information to be out there. All I’ve been able to find is workarounds on the related issues and nothing particularly clear.

Thanks in advance for any help!

Related Issues and Questions :

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
ChristosChristofidiscommented, May 16, 2018

of the top of my head im not sure what the exact snippet would be to get what you want but,

frame frame2 frame3 will always be the same frame, as nothing changes inbetween right?

(await page.frames())[0] this is the mainframe (await page.frames())[1] this is the first frame of the mainframe (await page.frames())[2] this is the second frame of the mainframe (await (await page.frames()[1].childFrames())[0] would be the first frame of the first frame of the mainframe

https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-frame

1reaction
aslushnikovcommented, May 17, 2018

@davidawad frame structure is not flattened; frames have subframes, so you should query frame’s children when you want to get them.

P.S. there’s also a frame.name() that you can use instead of reaching out for a private frame['name'].

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't access content of another frame in Chrome
The first frame needs to access elements of the second frame (xsample) when it's fully loaded and any onload JS functions have completed....
Read more >
Cant access to element inside a (frameset-->) frame
Hi I'm new in PowerShell , i try to get access elements inside frames in Internet Explorer exmpl. ****index.html*******. <!DOCTYPE html>
Read more >
Accessing frames in HTML from Squish for Web
Ensure that the content shown in the frame is being loaded from the same HTTP server as the original page, i.e. it has...
Read more >
Why won't my frames open within the same tab?
Although I have read nearly every forum article about this I can not fix this problem. I certainly must be missing something here....
Read more >
Frames in HTML documents - W3C
If the user agent can't display frames or is configured not to, it will render the contents of the NOFRAMES element. 16.2 Layout...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found