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

About opening a goroutine to the page, resulting in an error: assignment to entry in nil map #766

Closed
cplasfwst opened this issue Nov 24, 2022 · 2 comments
Labels
question Questions related to rod

Comments

@cplasfwst
Copy link

cplasfwst commented Nov 24, 2022

Rod Version: v0.112.0

The code to demonstrate your question


About opening a goroutine to the page, resulting in an error: assignment to entry in nil map
, the scenario is: I want to have a thread to detect whether the page jumps to the robot sliding detection, and if there is detection, the sliding will be completed automatically, but why is this error reported, and what solutions can be used to deal with it.


  1. Clone Rod to your local and cd to the repository:

    git clone https://github.com/go-rod/rod
    cd rod
  2. Use your code to replace the content of function TestRod in file rod_test.go.

  3. Test your code with: go test -run TestRod, make sure it fails as expected.

  4. Replace ALL THE CONTENT under "The code to demonstrate your question" with your TestRod function, like below:

``func HuoQu(page *rod.Page) {
urlArray := ExcelDuQu()
fmt.Println("数组的长度是:", len(urlArray))
var shangjia []ShangJia

go PanduanYanZheng(page)   !!!!!!!!!
//time.Sleep(time.Second*3)
go YanzhengmaShiBai(page)  !!!!!!!!



//for i := 0; i < 3; i++ {
for i := 0; i < len(urlArray); i++ {

	fmt.Println(urlArray[i])
	wait := page.MustWaitNavigation()  !!!!!!!!!!!!
	page.MustNavigate(urlArray[i])
	wait()
	//完美
	contactinfo,err := page.ElementX(`//li[@class="contactinfo"]/a`)
	if err != nil {
		fmt.Println("主线程有点小错误哦:",err)
	}

	//点击即将跳转新的页面

....................


## What you got

Such as what error you see.

## What you expected to see

Such as what you want to do.

## What have you tried to solve the question

Such as after modifying some source code of Rod you are able to get rid of the problem.
@cplasfwst cplasfwst added the question Questions related to rod label Nov 24, 2022
@rod-robot
Copy link

Please fix the format of your markdown:

10 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
11 MD035/hr-style Horizontal rule style [Expected: ------------------------------------; Actual: ----------------------------------------]
13 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
32:1 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
32 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
33 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 3]
34 MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
55 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
55 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]

generated by check-issue

@ysmood
Copy link
Member

ysmood commented Nov 25, 2022

#322

@ysmood ysmood closed this as completed Nov 25, 2022
@ysmood ysmood closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2022
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