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

I want to slide the mouse down when I judge that there are not enough elements, and stop the mouse scrolling until the number of elements I need is loaded #760

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

Comments

@cplasfwst
Copy link

Rod Version: v0.112.0

The code to demonstrate your question

`

//111重点是这里↓
//循环页数
for i := 0; i < atoi-1; i++ {

	//3.1, 寻找本页面所有连接
	newpage.WaitLoad()
	var gundong float64 = 100
	**for  {
		fmt.Println("来了")
		err6 := newpage.Timeout(3*time.Second).WaitElementsMoreThan(`div.mojar-element-title`, 50)
		if err6 != nil {
			fmt.Println(err6,"这个是错误")
			newpage.Mouse.MustScroll(0,gundong)
			gundong = gundong +100
			fmt.Println(gundong,"现在的移动是")
		}

	}**

	projects := newpage.MustElementsX(`//div[@class="mojar-element-title"]`)


	fmt.Println("一共有多少个链接:",len(projects))

	for _, project := range projects {
		link := project.MustElement("a")
		log.Printf(
			"project %s (%s): '%s'",
			link.MustText(),
			link.MustProperty("href"),
			project.MustText(),
		)
	}

	time.Sleep(time.Second*1)
	//寻找下一页的按钮
	xiayiye := newpage.MustElementX(`//a[@class="fui-next"]`)
	xiayiye.MustClick()
}`

中文:
我的问题,我希望判断元素不足够就鼠标向下滑动,知道加载到我需要的元素数量,才停止鼠标滚动,请问我应该如何实现?timeout不能实现吗?

Engilsh:
My question is, I want to slide the mouse down when I judge that there are not enough elements, and stop the mouse scrolling until the number of elements I need is loaded. How should I achieve this? Timeout can not be achieved?

@cplasfwst cplasfwst added the question Questions related to rod label Nov 20, 2022
@rod-robot
Copy link

Please fix the format of your markdown:

47 MD003/heading-style/header-style Heading style [Expected: atx; Actual: atx_closed]
47:3 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
47 MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "##"]

generated by check-issue

@ysmood
Copy link
Member

ysmood commented Nov 20, 2022

learn golang channel, goroutine and select

#322

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