Skip to content
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

GetOuterHTML().WithPierce(true) not returning <iframe> contents #1459

Open
azurda opened this issue Mar 29, 2024 · 0 comments
Open

GetOuterHTML().WithPierce(true) not returning <iframe> contents #1459

azurda opened this issue Mar 29, 2024 · 0 comments

Comments

@azurda
Copy link

azurda commented Mar 29, 2024

What versions are you running?

$ go list -m github.com/chromedp/chromedp
github.com/chromedp/chromedp v0.9.5
$ 123.0.6312.87 
go version
 go1.20.5 darwin/arm64

What did you do? Include clear steps.

Reproducible file: https://github.com/go-rod/rod/blob/main/fixtures/click-iframe.html

Relevant code section contained in chromedp.ActionFunc :

rootNode, err := dom.GetDocument().WithPierce(true).WithDepth(-1).Do(ctx)

if err != nil {
  return err 
}

htmlSource, err := dom.GetOuterHTML().WithNodeID(rootNode.NodeID).Do(ctx)

if err != nil {
 return err 
}

fmt.Println(htmlSource)

What did you expect to see?

I expected to see the whole DOM including the nested rendered content when using WithPierce(true). I know it is possible to create a context from the iframe target but that would require inserting the content later into the output of GetOuterHTML()

image

What did you see instead?

<html><head><style>
    iframe {
      margin: 100px;
      height: 200px;
      width: 200px;
    }
  </style>
  </head><body>
    <iframe src="./click.html"></iframe>

    <script>
      function testIsolation() {
        return 'ok'
      }
      testIsolation()
    </script>


</body></html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant