rod
rod copied to clipboard
PagePools and WaitEvent
Rod Version: v0.112.5
Can anyone help with my scenario please. Say I have a PagePool of 1 page (for simplicity), and within a method I navigate to a URL:
func fetchUrl(url string, myPagePool *page.PagePool) {
myPageFromPool := myPagePool.Get(createPage)
defer myPageFromPool.MustStopLoading()
defer myPagePool.Put(myPageFromPool)
var e proto.NetworkResponseReceived
waitForNetworkResponse := myPageFromPool.WaitEvent(&e)
...
myPageFromPool.MustNavigate(url)
waitForNetworkResponse()
...
}
What I am finding is that the proto.NetworkResponseReceived object seems to be getting events from the previous URL which was loaded in a prior invocation of fetchUrl.
Same doesn't happen if instead of using a PagePool, I just create a whole new page for each fetchUrl method call.
Am I missing something ? Is there a way to purge the page event queue each time I run fetchUrl ?
Please fix the format of your markdown:
5 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
generated by check-issue