Skip to content
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

本机有代理,却不能访问境外网站,境内可以是什么原因? #604

Closed
zlq1252 opened this issue May 17, 2022 · 2 comments
Closed

Comments

@zlq1252
Copy link

zlq1252 commented May 17, 2022

//-------------------------------------------------------这样写百度是可以访问↓------------------------------------------
path, _ := launcher.LookPath()
u := launcher.New().Delete("--headless").Set("--window-size=1920,1080").Bin(path).MustLaunch()
browser := rod.New().ControlURL(u).MustConnect()
router := browser.HijackRequests()
defer router.Stop()
router.MustAdd("", func(ctx *rod.Hijack) {
ctx.LoadResponse(http.DefaultClient, true)
fmt.Println(ctx.Request.URL().String())
})

go router.Run()
page := browser.MustPage()
wait := page.MustWaitNavigation()
page.MustNavigate("https://baidu.com/")
wait()

//-----------------------------------------------------------这样写谷歌不能访问↓-------------------------------------------------------

path, _ := launcher.LookPath()
u := launcher.New().Delete("--headless").Set("--window-size=1920,1080").Bin(path).MustLaunch()
browser := rod.New().ControlURL(u).MustConnect()
router := browser.HijackRequests()
defer router.Stop()
router.MustAdd("", func(ctx *rod.Hijack) {
ctx.LoadResponse(http.DefaultClient, true)
fmt.Println(ctx.Request.URL().String())
})

go router.Run()
page := browser.MustPage()
wait := page.MustWaitNavigation()
page.MustNavigate("https://google.com/")
wait()
@rod-robot
Copy link

Please add a valid **Rod Version:** v0.0.0 to your issue. Current version is v0.106.6
generated by check-issue

@ysmood
Copy link
Collaborator

ysmood commented May 17, 2022

#322

@ysmood ysmood closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants