go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5k stars 328 forks source link

Element存在,但Element.MustHas却为false,检测不到Element #1058

Closed ghost closed 1 month ago

ghost commented 1 month ago

Rod Version:0.116.0 页面URL:https://pub.alimama.com //先进入iframe loginIframe := tb.page.MustElement("iframe").MustFrame() //切换到扫码登录方式 if loginIframe.MustHas("#login>.view-type-qrcode") { loginIframe.MustElement("#login>.view-type-qrcode>.icon-qrcode").MustEval(()=>{let e = document.createEvent("MouseEvents");e.initEvent("click", true, true);this.dispatchEvent(e);}) } 问题1:loginIframe.MustHas始终返回false,但是loginIframe.MustElement("#login>.view-type-qrcode>.icon-qrcode")却可以正确取得Element。 问题2:loginIframe.MustElement("#login>.view-type-qrcode>.icon-qrcode").MustEval(()=>{let e = document.createEvent("MouseEvents");e.initEvent("click", true, true);this.dispatchEvent(e);})如果换成loginIframe.MustElement("#login>.view-type-qrcode>.icon-qrcode").MustClick(),偶尔会出现点击无效(有发送点击事件,但实际按钮事件未被触发)

github-actions[bot] commented 1 month ago

Please add a valid Rod Version: v0.0.0 to your issue. Current version is v0.116.0

Please fix the format of your markdown:

3:1 MD038/no-space-in-code Spaces inside code span elements [Context: "`"]
10:1 MD038/no-space-in-code Spaces inside code span elements [Context: "`"]

generated by check-issue

ysmood commented 1 month ago

322