rod icon indicating copy to clipboard operation
rod copied to clipboard

Support new headless Chrome --headless=new

Open alfonmga opened this issue 2 years ago • 3 comments

Rod Version: v0.112.6

The new headless Chrome has been released in November 2022. In this issue we could explore if Rod is stable for it.

package main

import (
	"github.com/go-rod/rod"
	"github.com/go-rod/rod/lib/launcher"
)

func main() {
	u := launcher.New().Set("headless", "new").MustLaunch() // use new headless mode
	page := rod.New().ControlURL(u).MustConnect().MustPage("https://www.wikipedia.org/")
	page.MustWaitLoad().MustScreenshot("a.png")
}

Problems I have encountered so far:

alfonmga avatar Feb 23 '23 18:02 alfonmga

Yeah, I have also noticed this new feature of Chrome, but this new feature will cause new bugs, which will cause the problem that --remote-debugging-address will not take effect. It will only listen on 127.0.0.1. For details : https://bugs.chromium.org/p/chromium/issues/detail?id=1373872&q=remote%20debugging%20address&can=2

Fly-Playgroud avatar Feb 24 '23 06:02 Fly-Playgroud

Rod Version: v0.112.6

The new headless Chrome has been released in November 2022. In this issue we could explore if Rod is stable for it.

package main

import (
	"github.com/go-rod/rod"
	"github.com/go-rod/rod/lib/launcher"
)

func main() {
	u := launcher.New().Set("headless", "new").MustLaunch() // use new headless mode
	page := rod.New().ControlURL(u).MustConnect().MustPage("https://www.wikipedia.org/")
	page.MustWaitLoad().MustScreenshot("a.png")
}

Problems I have encountered so far:

Hi, here you can give a temporary support solution: if you want to use the new Headless Mode, please use theLauncher.Set (flags.Headless, "new")). At present, Launcher.Headless (enable bool) this helper func will activate the old Headless Mode. Over time, this Helper Func will be activated by default to New Headless Mode. The length of this time depends on the update of Chrome. Of course, you can also display Launcher.Set (flags.Headless," old ") old Headless Mode.

Fly-Playgroud avatar Feb 24 '23 14:02 Fly-Playgroud

this new feature will cause new bugs, which will cause the problem that --remote-debugging-address will not take effect. It will only listen on 127.0.0.1. For details : https://bugs.chromium.org/p/chromium/issues/detail?id=1373872&q=remote%20debugging%20address&can=2

I didn't know about this bug, thanks for the heads up.

Hi, here you can give a temporary support solution: if you want to use the new Headless Mode, please use theLauncher.Set (flags.Headless, "new")).

Unfortunately, it doesn't fix the issue I mentioned. The Chromium application is still visible in the dock. It works fine on Windows, though.

UPDATE: It seems to be a bug on Chrome side: Issue 1414957: Dock icon shows in new headless mode.

alfonmga avatar Mar 18 '23 17:03 alfonmga