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

page request error [net::ERR_ABORTED 521] #779

Closed
UchihaArk opened this issue Dec 23, 2022 · 2 comments
Closed

page request error [net::ERR_ABORTED 521] #779

UchihaArk opened this issue Dec 23, 2022 · 2 comments
Labels
question Questions related to rod

Comments

@UchihaArk
Copy link

UchihaArk commented Dec 23, 2022

Rod Version: v0.112.2

The code to demonstrate question

func main() {
 u := launcher.New().
 	Headless(false).
 	Set("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36").
 	MustLaunch()

 browser := rod.New().
 	ControlURL(u).
 	MustConnect().
 	MustIncognito().
 	MustIgnoreCertErrors(true)

 page := stealth.MustPage(browser)
 err := page.Navigate("https://ggzyjyzx.tl.gov.cn/tlsggzy/ShowInfo/Jysearch.aspx?infotype&fbdate=all&jyly=&ywtype=006&zbfs=")
 if err != nil {
 	fmt.Print(err)
 	return
 }
 selector := "#result > div.ewb-list_bd > ul > li:nth-child(1) > div > a"
 err = page.Timeout(10*time.Second).WaitElementsMoreThan(selector, 0)
 if err != nil {
 	fmt.Print(err)
 	return
 }

 page.MustElement(selector).MustClick()
}

What you got

click page request error [net::ERR_ABORTED 521]

What you expected to see

request success

What have you tried to solve the question

solve code

Set("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")
stealth.MustPage(browser); //navicate is ok

// new page clear cookie,inject stealth.JS
go browser.EachEvent(func(e *proto.TargetTargetCreated) {
 	if e.TargetInfo.Type != proto.TargetTargetInfoTypePage {
 		return
 	}
 	page := browser.MustSetCookies().MustPageFromTargetID(e.TargetInfo.TargetID)
 	_, err := page.EvalOnNewDocument(stealth.JS)
 	if err != nil {
 		return
 	}
 })()
@UchihaArk UchihaArk added the question Questions related to rod label Dec 23, 2022
@rod-robot
Copy link

Please fix the format of your markdown:

5 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
44 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "## What have you tried to solve the question"]
46 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```go"]
64 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]

generated by check-issue

@ysmood
Copy link
Collaborator

ysmood commented Mar 15, 2023

👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

3 participants