go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.32k stars 347 forks source link

Is it possible to make a request through chrome's network stack ? #909

Open greg-lancet opened 1 year ago

greg-lancet commented 1 year ago

Rod Version: v0.114.1

Something like this:

browser := rod.New().ControlURL(launchUri.MustLaunch()).MustConnect()
page := browser.MustPage("<url>").MustWaitLoad()
var req *http.Request
page.Request(req) // launches the request through the page

It would useful for web scrappers who uses both a chrome driver & reverse engineered requests. Maybe you can already do it somehow ? Thanks.

github-actions[bot] commented 1 year ago

Please fix the format of your markdown:

4 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```golang"]
9 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

generated by check-issue

ysmood commented 1 year ago

Check the tutorial: https://go-rod.github.io/#/javascript-runtime

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

page.MustEval(`u => fetch(u)`, "https://test.com")