Do you can concurently launch several chrome instances each with own user-data-dir #429
Answered
by
ysmood
MikhailKlemin
asked this question in
Q&A
Replies: 2 comments 6 replies
-
Yes, you can. Check the unit test of Rod itself, it will run each test concurrently with multiple browsers. Line 60 in 0998fcc |
Beta Was this translation helpful? Give feedback.
5 replies
-
func create(profile string) *rod.Browser {
u := launcher.New().UserDataDir(profile).
Set("blink-settings", "imagesEnabled=false").
MustLaunch()
return rod.New().ControlURL(u).MustConnect()
}
func main() {
wg := sync.WaitGroup{}
for range "....." {
wg.Add(1)
go func() {
defer wg.Done()
p := filepath.Join(os.TempDir(), utils.RandString(8))
b := create(p)
b.MustPage()
fmt.Println("Browser started:", p)
time.Sleep(5 * time.Second)
b.MustClose()
fmt.Println("Browser stopped:", p)
}()
}
wg.Wait()
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
MikhailKlemin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I want is to have several instances running each with it's own datadir:
Say create concurrently several of this with different profiles?
I guess I cannot? Because new instance will mess up with already launched?
Beta Was this translation helpful? Give feedback.
All reactions