Comments (3)
router := browser.HijackRequests()
defer router.MustStop()
router.MustAdd("*", func(ctx *rod.Hijack) {
println(ctx.Request.Type(), ctx.Request.URL().String(), ctx.Request.Event().RequestID)
ctx.ContinueRequest(&proto.FetchContinueRequest{})
ctx.LoadResponse(&http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}, true)
})
go router.Run()
默认的是http.DefaultClient
func (h *Hijack) MustLoadResponse() {
h.browser.e(h.LoadResponse(http.DefaultClient, true))
}
修改成自定义的http.Client即可
from rod.
Perfect! Thank you for your time!
My full code for anyone looking at this issue later.
func HijackViaPage() {
browser := rod.New().MustConnect().MustIgnoreCertErrors(true)
page := browser.MustPage("")
// THIS WORKS, No issues.
page.MustNavigate("https://127.0.0.1/")
router := page.HijackRequests()
router.MustAdd("*", func(ctx *rod.Hijack) {
// Ignore certificate errors and fetch page.
ctx.LoadResponse(&http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}, true)
})
go router.Run()
page.MustNavigate("https://127.0.0.1")
from rod.
Closing as answered.
from rod.
Related Issues (20)
- How run multiple instances of chrome and have one manager go rod which handle this instances HOT 2
- ElementX stuck if you specify a non-existent element HOT 2
- Repeat login HOT 2
- 如何模拟鼠标滚动向下拉取加载数据? HOT 10
- Leakless feature problems... HOT 1
- 当浏览器关闭时,chrome_crashpad_handler和Chromium Helper两个进程没有被关闭。 HOT 3
- Is it possible to improve Screenshot's fullPage implementation? HOT 1
- Why doesn't it remember the window size now? HOT 11
- How to cancel the timeout for Elements (not just one)? HOT 1
- Intercept DevTools disconnection HOT 3
- Proxy auth dialog handler is not working in another tab HOT 4
- Is there a way to change or get download directory of browser? HOT 8
- page.Elements result have cache? HOT 1
- navigation failed: net::ERR_INVALID_AUTH_CREDENTIALS HOT 11
- chromium can't login gmail account HOT 11
- NewUserMode最多启动2个浏览器,在尝试启动2个以上浏览器后卡住 HOT 11
- Alert Trojan Virus HOT 2
- After setting the default system device, the viewport display height and width are reversed. HOT 2
- hijack无法加载Other类型请求 HOT 7
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.