Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(wk): wait for bootstrap scripts command response (#328)

Yury Semikhatsky6e0bb2585e79
diff --git a/src/webkit/wkFrameManager.ts b/src/webkit/wkFrameManager.ts
index 9a0d89a343..9308ee2bc0 100644
--- a/src/webkit/wkFrameManager.ts
+++ b/src/webkit/wkFrameManager.ts
@@ -71,7 +71,7 @@ export class WKFrameManager implements PageDelegate {
// New bootstrap scripts may have been added during provisional load, push them
// again to be on the safe side.
if (this._setBootstrapScripts.length)
- this._setBootstrapScripts(session);
+ this._setBootstrapScripts(session).catch(e => debugError(e));
}
// This method is called for provisional targets as well. The session passed as the parameter
@@ -100,7 +100,7 @@ export class WKFrameManager implements PageDelegate {
if (contextOptions.javaScriptEnabled === false)
promises.push(session.send('Emulation.setJavaScriptEnabled', { enabled: false }));
if (this._setBootstrapScripts.length && session.isProvisional())
- this._setBootstrapScripts(session);
+ promises.push(this._setBootstrapScripts(session));
if (contextOptions.bypassCSP)
promises.push(session.send('Page.setBypassCSP', { enabled: true }));
if (this._page._state.extraHTTPHeaders !== null)