rod
rod copied to clipboard
Proxy auth dialog handler is not working in another tab
Rod Version: v0.114.5
The code to demonstrate your question
func main () {
launcher := launcher.New().
Set(flags.ProxyServer, "proxy.example.com:8080").
Launch()
browserUrl, err := launcher.Launch()
if err != nil {
panic(err)
}
browser = rod.New().ControlURL(browserUrl).MustConnect()
go browser.MustHandleAuth("test", "howto123")()
}
What you got
Proxy auth dialog handler is not working in another tab
What you expect to see
The proxy auth connected in another tabs.
What have you tried to solve the question
Run the proxy handler goroutine with same opened tabs
Additional
the first tab was successfuly authenticated, except the another tab
Please fix the format of your markdown:
33 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## Additional"]
34:1 MD033/no-inline-html Inline HTML [Element: img]
generated by check-issue
you need two handlers, like this:
go browser.MustHandleAuth("test", "howto123")()
go browser.MustHandleAuth("test", "howto123")()
Read the doc, each event listener only waits for one single event, not all the events:
https://go-rod.github.io/#/events/README
@ysmood it will panic, even the first tab was connected to proxy
panic: {-32000 Invalid state for continueInterceptedRequest }
yes, you have to use EachEvent to handle it, read the source code of HandleAuth
following code is worked
- create page
- auth handle
browser.Page(proto.TargetCreateTarget{})
go p.browser.MustHandleAuth(username, password)()