소스 검색

fix scripts sooner

Gildas 4 년 전
부모
커밋
c155370fba
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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.sleep(3000);
 	}
+	scripts = scripts.replace(/globalThis/g, "window");
 	await driver.get(options.url);
 	if (options.browserCookies) {
 		await Promise.all(options.browserCookies.map(cookie => {
@@ -105,8 +106,7 @@ async function getPageData(driver, options) {
 		while (await driver.getCurrentUrl() == "about:blank") {
 			// do nothing
 		}
-	}
-	scripts = scripts.replace(/globalThis/g, "window");
+	}	
 	await driver.executeScript(scripts);
 	if (options.browserWaitUntil != "domcontentloaded") {
 		let scriptPromise;