Comments (5)
too fast to see the log before it closes
from rod.
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 ERR_NAME_NOT_RESOLVED
. How can I do that ? Thank you !
from rod.
I can't get this error with the code you provide. How to reproduce ERR_NAME_NOT_RESOLVED?
from rod.
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
from rod.
To capture the browser log, add a handler for proto.LogEntryAdded events:
go page.EachEvent(func(e *proto.LogEntryAdded) {
msg, _ := json.Marshal(e.Entry)
fmt.Println(string(msg))
})()
from rod.
Related Issues (20)
- Proxy and Hijack HOT 3
- Just a recipe to run a go-rod program as systemd service HOT 1
- How to Log CDP Logs to a File or Use slog HOT 2
- Failed to deserialize params.body - BINDINGS: binary value expected at position 61 HOT 5
- failed page screenshot in defer HOT 2
- launcher docker 是否支持常驻且直接连接 HOT 4
- Examples fail on Ubuntu 24.04 with "No usable sandbox!" HOT 8
- Open the webpage, the page size is changed HOT 1
- Limit the number of redirects and store all accessed URLs HOT 1
- NewUserMode 无法关闭浏览器 HOT 1
- NewUserMode 和 NewManaged 可以同时使用吗 HOT 1
- How do I get Ifram without using--disable-site-isolation-trials? HOT 4
- navigation failed: net::ERR_TUNNEL_CONNECTION_FAILED HOT 1
- using "MustPage" to open the page will simulate a device by default HOT 2
- Any idea about cdp hang at syscall? HOT 1
- Panic on .HTML() HOT 8
- 找不到元素,点击按钮超时等问题 HOT 3
- 总是“panic: context deadline exceeded”,任何一步都有可能 HOT 2
- MustWaitStable 在特定网站会始终阻塞 HOT 2
- how can I set up a proxy for this request after hijacking the domain name? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rod.