Browse Source

minor fix

Gildas 7 năm trước cách đây
mục cha
commit
08666065c3
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      cli/back-ends/webdriver-chrome.js
  2. 1 1
      cli/back-ends/webdriver-firefox.js

+ 1 - 1
cli/back-ends/webdriver-chrome.js

@@ -102,7 +102,7 @@ exports.getPageData = async options => {
 		} else if (!optionHeadless && options.browserWaitUntil == "networkidle2") {
 			await driver.executeAsyncScript(scripts + "\naddEventListener(\"single-file-network-idle-2\", () => arguments[0](), true)");
 		} else if (optionHeadless || options.browserWaitUntil == "load") {
-			await driver.executeAsyncScript(scripts + "\nif (document.readyState == \"loading\") { document.addEventListener(\"load\", () => arguments[0]()) } else { arguments[0](); }");
+			await driver.executeAsyncScript(scripts + "\nif (document.readyState == \"loading\" || document.readyState == \"interactive\") { document.addEventListener(\"load\", () => arguments[0]()) } else { arguments[0](); }");
 		} else {
 			await driver.executeScript(scripts);
 		}

+ 1 - 1
cli/back-ends/webdriver-firefox.js

@@ -102,7 +102,7 @@ exports.getPageData = async options => {
 		} else if (options.browserWaitUntil == "networkidle2") {
 			await driver.executeAsyncScript(scripts + "\naddEventListener(\"single-file-network-idle-2\", () => arguments[0](), true)");
 		} else if (options.browserWaitUntil == "load") {
-			await driver.executeAsyncScript(scripts + "\nif (document.readyState == \"loading\") { document.addEventListener(\"load\", () => arguments[0]()) } else { arguments[0](); }");
+			await driver.executeAsyncScript(scripts + "\nif (document.readyState == \"loading\" || document.readyState == \"interactive\") { document.addEventListener(\"load\", () => arguments[0]()) } else { arguments[0](); }");
 		} else {
 			await driver.executeScript(scripts);
 		}