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

Bug: MustWaitStable causes panic after browser.MustPage() #1157

Open
independentid opened this issue Dec 1, 2024 · 3 comments
Open

Bug: MustWaitStable causes panic after browser.MustPage() #1157

independentid opened this issue Dec 1, 2024 · 3 comments

Comments

@independentid
Copy link

independentid commented Dec 1, 2024

After calling browser.MustPage(url), a subsequent call to MustWaitStable causes panic. While Must normally throws a panic if an error occurs, it seems unexpected that MustWaitStable would throw any errors since it isn't triggering on any type of content. The bug is really about getting Execution context was destroyed except when stepping in the debug mode.

    l := launcher.New().
        Headless(false).
        Devtools(true).
        Set("disable-gpu", "true")
    defer l.Cleanup()

    // Launch the browser and return the URL for the browser control service
    bUrl := l.MustLaunch()

    browser := rod.New().ControlURL(bUrl).
        Trace(true).
        SlowMotion(time.Second).
        MustConnect()

    browser.IgnoreCertErrors(true)
    defer browser.MustClose()

    page := browser.MustPage(oagUrl)
    page.MustWaitStable()

Panic report:

[rod] 2024/11/30 16:37:09 [wait] stable <page:BBC7C4AF>
[rod] 2024/11/30 16:37:09 [wait] dom-stable <page:BBC7C4AF>
[rod] 2024/11/30 16:37:09 [wait] request-idle <page:BBC7C4AF>
[rod] 2024/11/30 16:37:09 [wait] load <page:BBC7C4AF>
[rod] 2024/11/30 16:37:09 [wait requests idle] map[excludes:[] includes:[]] <page:BBC7C4AF>
[rod] 2024/11/30 16:37:10 [wait requests] <page:BBC7C4AF> map[]
panic: {-32000 Execution context was destroyed. }
 
goroutine 1 [running]:
github.com/go-rod/rod/lib/utils.init.func2({0x1016f7860, 0x14000299f20})
        /Users/pjdhunt/go/pkg/mod/github.com/go-rod/[email protected]/lib/utils/utils.go:68 +0x24
github.com/go-rod/rod.genE.func1({0x140002a7830, 0x1, 0x1})
        /Users/pjdhunt/go/pkg/mod/github.com/go-rod/[email protected]/must.go:36 +0x124
github.com/go-rod/rod.(*Page).MustWaitStable(0x1400014e000)
        /Users/pjdhunt/go/pkg/mod/github.com/go-rod/[email protected]/must.go:451 +0xf0
main.main()
        /Users/pjdhunt/workspace_strata/okta-disco/cmd/rod/main.go:69 +0x4a4
Exiting.

Rod Version: v0.116.2

@independentid
Copy link
Author

Rod Version: v0.116.2

@independentid
Copy link
Author

The underlying error appears to be:
Execution context was destroyed.

This does not happen when stepping through code in debug mode.

@sethgrid
Copy link

Ah, this was my problem! I removed the calls to MustWaitStable and replaced them with time.Sleep as a workaround

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

2 participants