Skip to content
Discussion options

You must be logged in to vote

Have you checked:

rod/page.go

Lines 878 to 879 in b6b42d8

// EvalOnNewDocument Evaluates given script in every frame upon creation (before loading frame's scripts).
func (p *Page) EvalOnNewDocument(js string) (remove func() error, err error) {

Its unit test is its doc:

rod/page_eval_test.go

Lines 14 to 30 in 945ca02

func TestPageEvalOnNewDocument(t *testing.T) {
g := setup(t)
p := g.newPage()
p.MustEvalOnNewDocument(`window.rod = 'ok'`)
// to activate the script
p.MustNavigate(g.blank())
g.Eq(p.MustEval("() => rod").String(), "ok")
g.Panic(func() {
g.mc.stubErr(1, proto.PageAddScriptToEvalu…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jonmol
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants