From ce9638094c4ff30175be8a5d5a949ab6538fc3cd Mon Sep 17 00:00:00 2001 From: "s.roeck" Date: Thu, 10 Aug 2023 12:16:16 +0200 Subject: [PATCH] #806 Fix "failed to find element" - Rerender story after the cleanup events have been fired - Remove workaround from #712 --- packages/storycap/src/node/capturing-browser.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/storycap/src/node/capturing-browser.ts b/packages/storycap/src/node/capturing-browser.ts index baeefaa54..e74ed8f17 100644 --- a/packages/storycap/src/node/capturing-browser.ts +++ b/packages/storycap/src/node/capturing-browser.ts @@ -126,23 +126,18 @@ export class CapturingBrowser extends StoryPreviewBrowser { const story = this.currentStory; if (!this.touched || !story) return; this.debug('Reset story because page state got dirty in this request.', this.currentRequestId); - await this.setCurrentStory(story, { forceRerender: true }); // Clear the browser's mouse state. if (screenshotOptions.click) { - // Workaround for an issue where puppeteer fails to find a matching element. - // https://github.com/reg-viz/storycap/issues/712 - await this.page.evaluate(() => {}); await this.page.$eval(screenshotOptions.click, (e: unknown) => (e as HTMLElement)?.blur()); } if (screenshotOptions.focus) { - // Workaround for an issue where puppeteer fails to find a matching element. - // https://github.com/reg-viz/storycap/issues/712 - await this.page.evaluate(() => {}); await this.page.$eval(screenshotOptions.focus, (e: unknown) => (e as HTMLElement)?.blur()); } await this.page.mouse.move(0, 0); await this.page.mouse.click(0, 0); + + await this.setCurrentStory(story, { forceRerender: true }); this.touched = false; return;