You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Runtime.evaluate can happen before Page.addScriptToEvaluateOnNewDocument #182
The issue is that you may have successfully completed Page.addScriptToEvaluateOnNewDocument, however you can still occasionally call Runtime.evaluate or Runtime.callFunctionOn when a page is loading and it will evaluate before the new document script.
This behavior seems like a race, as I was only able to repro it with a contrived situation where I purposefully do not await page.goto (however it happens in our production code). This script picks between two urls that may have iframes and loads them randomly. I've reproduced this with puppeteer, however I believe it is unlikely a puppeteer bug:
Isn't this expected @TrevorSundberg? The solution here is to awaitpage.goto before evaluating whatever it is you need to evaluate at which point you're certain that Page. addScriptToEvaluateOnNewDocument has been evaluated.
Activity
patrickhulce commentedon Jul 30, 2019
Isn't this expected @TrevorSundberg? The solution here is to
awaitpage.gotobefore evaluating whatever it is you need to evaluate at which point you're certain thatPage. addScriptToEvaluateOnNewDocumenthas been evaluated.TimvdLippe commentedon Apr 9, 2020
This repository is related to Chrome DevTools Protocol, but does not track issues regarding its definition or implementation. If you want to file an issue for the Chrome DevTools Protocol, please open an issue on https://crbug.com under
component: Platform>DevTools>Platform. Thanks in advance!