Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#806 Fix "failed to find element" #807

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions packages/storycap/src/node/capturing-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down