Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy auth dialog handler is not working in another tab #991

Open
itzngga opened this issue Dec 18, 2023 · 5 comments
Open

Proxy auth dialog handler is not working in another tab #991

itzngga opened this issue Dec 18, 2023 · 5 comments
Labels
question Questions related to rod

Comments

@itzngga
Copy link

itzngga commented Dec 18, 2023

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

Tangkapan Layar 2023-12-18 pukul 11 45 34 AM

the first tab was successfuly authenticated, except the another tab

@itzngga itzngga added the question Questions related to rod label Dec 18, 2023
Copy link

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

@ysmood
Copy link
Collaborator

ysmood commented Dec 18, 2023

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

@itzngga
Copy link
Author

itzngga commented Dec 18, 2023

@ysmood
it will panic, even the first tab was connected to proxy

panic: {-32000 Invalid state for continueInterceptedRequest } 

@ysmood
Copy link
Collaborator

ysmood commented Dec 18, 2023

yes, you have to use EachEvent to handle it, read the source code of HandleAuth

@xujinzheng
Copy link
Contributor

following code is worked

  1. create page
  2. auth handle
browser.Page(proto.TargetCreateTarget{})
go p.browser.MustHandleAuth(username, password)()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

3 participants