Comments (3)
Please add a valid Rod Version: v0.0.0
to your issue. Current version is v0.114.5
generated by check-issue
from rod.
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
from rod.
I hope it helps others
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(e *proto.NetworkResponseReceived) {
reply, err := (proto.NetworkGetResponseBody{RequestID: e.RequestID}).Call(page)
if err != nil {
fmt.Println(err)
}
fmt.Println(reply.Body)
})()
}()
time.Sleep(3 * time.Second)
page.MustNavigate("https://www.baidu.com")
select {}
}
from rod.
Related Issues (20)
- Get all javascript or css resources of the same-origin HOT 3
- page.MustExpose not work in launcher.NewAppMode() HOT 2
- Is it correct for me to call stealth like this? I want the entire browser to pass detection effectively, not a single page. Code: HOT 2
- Resources content is nil HOT 2
- rod resets settings of a chrome profile HOT 2
- Chinese garbled code HOT 2
- 浏览器的角标怎么设置? HOT 2
- 并发page pool, context deadline exceeded,page为什么没有释放? HOT 2
- Add support for Linux Arm? for downloading etc. HOT 4
- Add an initEvents public function with a Browser structure HOT 5
- page.Navigate(url), the page is like blocked HOT 1
- 测试时如何获取当前网页 HOT 5
- Click Button Eval Js Not Working HOT 4
- 获取点击后的response失败 HOT 2
- How to hide chromium command prompt HOT 2
- Element存在,但Element.MustHas却为false,检测不到Element HOT 2
- How to open a new Chrome window while using remote control HOT 4
- Using go-rod with firefox, failing to start new instance of firefox HOT 6
- How to disable the dialog when open External protocols HOT 2
- How to Set or replace response headers 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.