go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.

Home Page:https://go-rod.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

找不到元素,点击按钮超时等问题

stevenyangecho opened this issue · comments

Rod Version: v0.116.1

The code to demonstrate your question

 
f := e.Page()
f.MustWaitStable()
f1 := f.MustElementR("button.t-dialog__confirm", "确定")
f1.MustWaitStable()
f1.MustClick()

这个按钮是之前点击后,弹出的一个对话框,
但是日志,却会出现 rod.ElementNotFoundError 的错误

[rod] 2024/06/27 17:18:32 [query] rod.elementR("button.t-dialog__confirm","确定")  <page:83C154CF>
[rod] 2024/06/27 17:18:32 [wait] visible <button.t-dialog__confirm>
2024-06-27T17:18:32 [ERRO] {34f2706fe5714baa2a76207bb606ab0a} [UserId:1] error value: &rod.ElementNotFoundError{}

同时在 打开的chrome里面,console 里输入

$("button.t-dialog__confirm")
能找到元素
image

第二个问题

页面上确认选择没问题,也能正常看到按钮,但是MustClick点击的时候,有时候会出现 [wait] stable RAF 一直等待,直到超时...多重复几次,运行有很大失败概率,有时候又可以成功

[rod] 2024/06/27 17:18:27 [wait] stable RAF <button.

Please fix the format of your markdown:

5:1 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
7 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
14 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
17 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
17 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
21 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]

generated by check-issue

有办法让我复现这个问题吗?

没事了,大概知道原因,原来是网站魔幻操作,同一个页面弹出框有N个隐藏同样属性的....