playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
1.94k stars 144 forks source link

Assign values to js's variables or Call a js function fail. #420

Closed ctinkong closed 4 months ago

ctinkong commented 4 months ago

I want to assign value to a variable which is variable of javascript file of the open url, and call a function of the open url too. I try like this

        js := fmt.Sprintf(`
        g_creationSessionID = 123456;
        WaitForEmailVerification();
        `)
    _, err = page.Evaluate(js)

but when i debug the webside,

g_creationSessionID

do not change and the fucntion

WaitForEmailVerification

do not call.

I am using correctly, right? Thank you.

ctinkong commented 4 months ago

fix it.