go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.

Home Page:https://go-rod.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rod resets settings of a chrome profile

xob0t opened this issue · comments

Rod Version: v0.114.8

I'm launching rod with a specified Chrome profile.
All works as expected, but some profile settings are reset after the launch.
I noticed:

  • "Enhanced Ad Privacy" always pops up - probably resets its preferences
  • All extensions are unpinned
  • New tab shortcuts are reset

I've tried launching Chrome directly without rod, but with the same args as it launches it with, and have not encountered this issue.


import (
	"fmt"

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

var (
	ProfileDir    string = "Profile 51"
	UserDataDir   string = "C:\\Users\\admin\\AppData\\Local\\Google\\Chrome\\User Data"
	ChromeBinPath string = "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
)

func main() {
	launcher := launcher.New().
		Bin(ChromeBinPath).
		Set("user-data-dir", UserDataDir).
		Set("profile-directory", ProfileDir).
		Leakless(false).
		Headless(false)
	cu, err := launcher.Launch()
	if err != nil {
		fmt.Println(err)
	}
	browser := rod.New().ControlURL(cu)
	err = browser.Connect()
	if err != nil {
		fmt.Println(err)
	}
	defer browser.Close()
}

demo:
https://github.com/go-rod/rod/assets/32616886/85b70ab3-9a7c-4573-9e8e-ec583292ac2c

Could you try the v0.115.0

the issue is gone, mad respect for the quick fix!