-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Can I check Internet activity #986
Labels
question
Questions related to rod
Comments
duolabmeng6
changed the title
Can I block network requests
Can I check Internet activity
Dec 1, 2023
Please add a valid generated by check-issue |
package main
import (
"fmt"
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/launcher"
"github.com/go-rod/rod/lib/proto"
"time"
)
func main() {
url := launcher.New().Headless(false).MustLaunch()
browser := rod.New().ControlURL(url).MustConnect()
page := browser.MustPage("")
go func() {
page.EachEvent(func(e *proto.NetworkRequestWillBeSent) {
fmt.Printf("Request: %s %s\n", e.Request.Method, e.Request.URL)
}, func(r *proto.NetworkResponseReceived) {
//How do I get the contents of the body here
//m := proto.NetworkGetResponseBody{RequestID: r.RequestID}
//r, _ = m.Call(page)
})()
}()
time.Sleep(3 * time.Second)
page.MustNavigate("https://www.baidu.com")
select {}
} How do I get the contents of the body here |
I hope it helps others
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since I didn't find an example of blocking network requests in the example, let me ask that I want to see all network activity in the browser
The text was updated successfully, but these errors were encountered: