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
Get browser console errors #981
Comments
too fast to see the log before it closes |
package main
import (
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/proto"
"fmt"
"time"
"log"
)
func main() {
u := "https://ubuntu.com/core"
page := rod.New().MustConnect().MustPage()
done := make(chan int)
go page.EachEvent(func(e *proto.RuntimeConsoleAPICalled) {
fmt.Println(page.MustObjectsToJSON(e.Args))
close(done)
})()
page.Timeout(30 * time.Second).MustNavigate(u).MustWaitNavigation()
log.Printf("waiting 10 sec")
time.Sleep(10 * time.Second)
log.Printf("finished waiting")
} Even with delay, I only see the JS console.log. I would like to see the errors and warnings like |
I can't get this error with the code you provide. How to reproduce ERR_NAME_NOT_RESOLVED? |
Thanks for your answer. It was just an example. Here is a real example. The URL https://helpdesk.paessler.com/en/support/home returns all the errors below. How can I get the same console messages with go-rod ? package main
import (
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/proto"
"fmt"
"time"
"log"
)
func main() {
u := "https://helpdesk.paessler.com/en/support/home"
page := rod.New().MustConnect().MustPage()
done := make(chan int)
go page.EachEvent(func(e *proto.RuntimeConsoleAPICalled) {
fmt.Println(page.MustObjectsToJSON(e.Args))
close(done)
})()
page.Timeout(30 * time.Second).MustNavigate(u).MustWaitNavigation()
log.Printf("waiting 10 sec")
time.Sleep(10 * time.Second)
log.Printf("finished waiting")
} Thank you for your time |
Rod Version: v0.114.5
I would like to get the browser error logs/events such as
ERR_NAME_NOT_RESOLVED
when browsing URLs with the associated loaded network ressource URL. I can see an issue with the same question here #330, but the code sample above doesn't work. What am I doing wrong ? Thank you !The text was updated successfully, but these errors were encountered: