Last active
October 30, 2020 06:51
-
-
Save ysmood/0d5b2c878ecbdb598776af7d3d305b79 to your computer and use it in GitHub Desktop.
Such as when you want to inject a large js helper to the page, chromedp will crash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"strings" | |
"github.com/chromedp/chromedp" | |
) | |
func main() { | |
ctx, cancel := chromedp.NewContext(context.Background()) | |
defer cancel() | |
var res string | |
err := chromedp.Run(ctx, | |
chromedp.Navigate(`https://example.com/`), | |
chromedp.Evaluate(fmt.Sprintf(`"%s"`, strings.Repeat("t", 2_000_000)), &res), | |
) | |
if err != nil { | |
log.Fatal(err) // will fail at here: context canceled | |
} | |
log.Println(len(res)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rod doesn't have this limitation: