lib/grover/js/processor.js in grover-1.0.4 vs lib/grover/js/processor.js in grover-1.0.5

- old
+ new

@@ -89,41 +89,35 @@ } // Emulate the media features, if specified const mediaFeatures = options.mediaFeatures; delete options.mediaFeatures; if (Array.isArray(mediaFeatures)) { - page.emulateMediaFeatures(mediaFeatures); + await page.emulateMediaFeatures(mediaFeatures); } // Emulate timezone (if provided) const timezone = options.timezone; delete options.timezone; if (timezone !== undefined) { await page.emulateTimezone(timezone); } - // Emulate vision deficiency (if provided) - const visionDeficiency = options.visionDeficiency; delete options.visionDeficiency; - if (visionDeficiency !== undefined) { - page.emulateVisionDeficiency(type); - } - // Bypass CSP (content security policy), if provided const bypassCSP = options.bypassCSP; delete options.bypassCSP; if (bypassCSP !== undefined) { - page.setBypassCSP(bypassCSP); + await page.setBypassCSP(bypassCSP); } // Add extra HTTP headers (if provided) const extraHTTPHeaders = options.extraHTTPHeaders; delete options.extraHTTPHeaders; if (extraHTTPHeaders !== undefined) { - page.setExtraHTTPHeaders(extraHTTPHeaders); + await page.setExtraHTTPHeaders(extraHTTPHeaders); } // Set geolocation (if provided) const geolocation = options.geolocation; delete options.geolocation; if (geolocation !== undefined) { - page.setGeolocation(geolocation); + await page.setGeolocation(geolocation); } const raiseOnRequestFailure = options.raiseOnRequestFailure; delete options.raiseOnRequestFailure; if (raiseOnRequestFailure) { page.on('requestfinished', (request) => { @@ -197,9 +191,15 @@ // If specified, wait for timeout const waitForTimeout = options.waitForTimeout; delete options.waitForTimeout; if (waitForTimeout !== undefined) { await page.waitForTimeout(waitForTimeout); + } + + // Emulate vision deficiency (if provided) + const visionDeficiency = options.visionDeficiency; delete options.visionDeficiency; + if (visionDeficiency !== undefined) { + await page.emulateVisionDeficiency(visionDeficiency); } // If specified, focus on the specified selector const focusSelector = options.focus; delete options.focus; if (focusSelector !== undefined) {