func Test() {
u := launcher.New().HeadlessNew(false).MustLaunch()
browser := rod.New().ControlURL(u).MustConnect()
page := browser.MustPage("")
defer browser.MustClose()
var e proto.NetworkResponseReceived
wait := page.WaitEvent(&e)
page.MustNavigate("https://www.offers-pick.com/sports-outdoors/sleeping-bags")
wait()
originTab := page
// 等待页面稳定
page.MustWaitStable()
elements, _ := page.ElementsX("//div[@class='product-list']//div[text() = ' CHECK PRICE ']")
for _, element := range elements {
element.MustClick()
time.Sleep(time.Second * 1)
browser.MustSetCookies()
originTab.MustActivate()
time.Sleep(time.Second * 2)
}
time.Sleep(time.Minute * 30)
}
go-rod Click on several elements. After clicking on an element, a new tab is opened. Switch back to the original tab and you can't click any further. The program is stuck.
Rod Version: v0.116.2
The code to demonstrate your question
go-rod Click on several elements. After clicking on an element, a new tab is opened. Switch back to the original tab and you can't click any further. The program is stuck.