Skip to content

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

fix(setContent): handle inner _waitForLoadState rejection (#1382)

Dmitry Gozman26479119b6de
diff --git a/src/frames.ts b/src/frames.ts
index c2e508ea6c..7740a27695 100644
--- a/src/frames.ts
+++ b/src/frames.ts
@@ -635,11 +635,11 @@ export class Frame {
async setContent(html: string, options?: types.NavigateOptions): Promise<void> {
const tag = `--playwright--set--content--${this._id}--${++this._setContentCounter}--`;
const context = await this._utilityContext();
- const lifecyclePromise = new Promise(resolve => {
+ const lifecyclePromise = new Promise((resolve, reject) => {
this._page._frameManager._consoleMessageTags.set(tag, () => {
// Clear lifecycle right after document.open() - see 'tag' below.
this._page._frameManager.clearFrameLifecycle(this);
- resolve(this._waitForLoadState(options));
+ this._waitForLoadState(options).then(resolve).catch(reject);
});
});
const contentPromise = context.evaluate((html, tag) => {