rod icon indicating copy to clipboard operation
rod copied to clipboard

PagePools and WaitEvent

Open pedro-leitao opened this issue 2 years ago • 1 comments

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 ?

pedro-leitao avatar Mar 03 '23 11:03 pedro-leitao

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

rod-robot avatar Mar 03 '23 11:03 rod-robot