Go web 自动化库“Rod”卡在选择元素上

问题描述

我在使用以下简单程序时遇到问题。它应该去这个网站并尝试登录

StreamingDataReader

尝试选择页面时卡住了。MustElementX(pip) 我还尝试了一些其他方法来选择此元素,例如使用 CSS 选择器,但它也不起作用。

我在 package main 所在的文件夹中也有 .rod 文件,其中包含以下内容以帮助调试:

package main

import (
    "time"
    "github.com/go-rod/rod"
    "github.com/go-rod/rod/lib/input"
)

func main() {
    page := rod.New().MustConnect().MustPage("https://b2b.futbolsport.pl/").MustwindowFullscreen()
    page.MustWaitLoad()
    page.MustElement("#header > div > div:nth-child(3) > a.button__secondary.button--rounded.text-uppercase.show-modal").MustClick()
    page.MustElementX(`//*[@id="login"]`).MustInput("login")
    page.MustElementX(`//*[@id="password"]`).MustInput("password").MustPress(input.Enter)
    page.MustElement("#modal__login > div.dialog__Box > div.dialog__Box-content > form > div:nth-child(3) > button").MustClick()

    time.Sleep(time.Hour)
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)