From a63077d76835cee5ccf2af005505fd377ba87449 Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Tue, 5 Nov 2024 11:06:18 -0500 Subject: [PATCH] Apply suggestions from code review --- src/crawler.ts | 10 ++++++---- src/util/argParser.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/crawler.ts b/src/crawler.ts index 4de81062..ffa82fb9 100644 --- a/src/crawler.ts +++ b/src/crawler.ts @@ -1023,7 +1023,11 @@ self.__bx_behaviors.selectMainBehavior(); await textextract.extractAndStoreText("textFinal", true, true); } - if (this.params.screenshot && this.screenshotWriter) { + if ( + this.params.screenshot && + this.screenshotWriter && + this.params.screenshot.includes("fullPageAfterBehaviors") + ) { await page.evaluate(() => { window.scrollTo(0, 0); }); @@ -1033,9 +1037,7 @@ self.__bx_behaviors.selectMainBehavior(); url, writer: this.screenshotWriter, }); - if (this.params.screenshot.includes("fullPageAfterBehaviors")) { - await screenshots.takeFullPageAfterBehaviours(); - } + await screenshots.takeFullPageAfterBehaviours(); } } } diff --git a/src/util/argParser.ts b/src/util/argParser.ts index 30ac6658..83286848 100644 --- a/src/util/argParser.ts +++ b/src/util/argParser.ts @@ -377,7 +377,7 @@ class ArgParser { screenshot: { describe: - "Screenshot options for crawler, can include: view, thumbnail, fullPage, fullPageAfterBehaviors", + "Screenshot options for crawler, can include: view, thumbnail, fullPage, fullPageAfterBehaviors", type: "array", default: [], choices: Array.from(Object.keys(screenshotTypes)),