go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.43k stars 357 forks source link

每次调用截图功能,不管结束没结束,按ctrl+c结束任务后,会弹出一个黑色的控制台,这是什么? #1098

Closed arieslee closed 4 months ago

arieslee commented 4 months ago

Rod Version: v0.116.2

关键代码:

    launcher := s.launcher(req)
    page := rod.New().ControlURL(launcher.MustLaunch()).MustConnect().MustPage(req.Url)
    defer func() {
        page.MustClose()
        launcher.Cleanup()
    }()
    ua := &proto.NetworkSetUserAgentOverride{
        UserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
    }
    page.MustSetViewport(682, 1080, 1, true).SetUserAgent(ua)
    page.MustSearch(`#verify-bar-close`).MustClick()
    page.MustSearch(`[class="css-id3gl-IconClose e1vz198y3"]`).MustClick()
    saveName := saveFileName(req.FileName, req.Url)
    pageWaitStable := page.MustWaitStable()
    pageWaitStable.MustScreenshot(saveName)

如果多次截图,会出现多个黑色的控制台,按ctrl+c后,弹出,请问这是什么?我能不能在截图完成后,用程序关闭它?

github-actions[bot] commented 4 months ago

Please fix the format of your markdown:

4 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```go"]
20 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

generated by check-issue

ysmood commented 4 months ago

leakless