go-rod / rod

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

How to use start-fullscreen flag #323

Closed chengxiao closed 3 years ago

chengxiao commented 3 years ago
l := launcher.New().Headless(false).Set("start-fullscreen")

not work in rod, but it worked in chromedp

chromedp.Flag("start-fullscreen", true)

How can I set the chrome fullscreen or set the window size?

gh-robot commented 3 years ago

Please add a valid **Rod Version:** v0.0.0 to your issue. Current version is v0.85.9 generated by check-issue

ysmood commented 3 years ago

Better to use Page.MustWindowFullscreen: #274

You have to remove no-startup-window flag to use start-fullscreen, chrome team should doc it:

func main() {
    u := launcher.New().
        Headless(false).
        Set("start-fullscreen").
        Delete("no-startup-window").
        MustLaunch()

    browser := rod.New().ControlURL(u).MustConnect().NoDefaultDevice()

    browser.MustPage("http://example.com")

    utils.Pause()
}