Explorar el Código

fix scripts sooner

Gildas hace 4 años
padre
commit
c155370fba
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      cli/back-ends/webdriver-gecko.js

+ 2 - 2
cli/back-ends/webdriver-gecko.js

@@ -92,6 +92,7 @@ async function getPageData(driver, options) {
 		await driver.findElement(By.css("html")).sendKeys(Key.SHIFT + Key.F5);
 		await driver.findElement(By.css("html")).sendKeys(Key.SHIFT + Key.F5);
 		await driver.sleep(3000);
 		await driver.sleep(3000);
 	}
 	}
+	scripts = scripts.replace(/globalThis/g, "window");
 	await driver.get(options.url);
 	await driver.get(options.url);
 	if (options.browserCookies) {
 	if (options.browserCookies) {
 		await Promise.all(options.browserCookies.map(cookie => {
 		await Promise.all(options.browserCookies.map(cookie => {
@@ -105,8 +106,7 @@ async function getPageData(driver, options) {
 		while (await driver.getCurrentUrl() == "about:blank") {
 		while (await driver.getCurrentUrl() == "about:blank") {
 			// do nothing
 			// do nothing
 		}
 		}
-	}
-	scripts = scripts.replace(/globalThis/g, "window");
+	}	
 	await driver.executeScript(scripts);
 	await driver.executeScript(scripts);
 	if (options.browserWaitUntil != "domcontentloaded") {
 	if (options.browserWaitUntil != "domcontentloaded") {
 		let scriptPromise;
 		let scriptPromise;