瀏覽代碼

set pageLoadStrategy to eager instead of none

Gildas 7 年之前
父節點
當前提交
66f911ef6b
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      cli/back-ends/webdriver-firefox.js

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

@@ -58,7 +58,7 @@ exports.getPageData = async options => {
 	};
 	let driver;
 	try {
-		const builder = new Builder().withCapabilities({ "pageLoadStrategy": "none" });
+		const builder = new Builder().withCapabilities({ "pageLoadStrategy": "eager" });
 		const firefoxOptions = new firefox.Options();
 		if (options.browserHeadless === undefined || options.browserHeadless) {
 			firefoxOptions.headless();
@@ -97,7 +97,6 @@ exports.getPageData = async options => {
 		let scripts = SCRIPTS.map(scriptPath => fs.readFileSync(require.resolve(scriptPath)).toString().replace(/\n(this)\.([^ ]+) = (this)\.([^ ]+) \|\|/g, "\nwindow.$2 = window.$4 ||")).join("\n");
 		scripts += "\nlazyLoader.getScriptContent = " + (function (path) { return (RESOLVED_CONTENTS)[path]; }).toString().replace("RESOLVED_CONTENTS", JSON.stringify(RESOLVED_CONTENTS)) + ";";
 		await driver.get(options.url);
-		await driver.wait(() => driver.executeScript("return location.href != \"about:blank\""));
 		if (options.browserWaitUntil === undefined || options.browserWaitUntil == "networkidle0") {
 			await driver.executeAsyncScript(scripts + "\naddEventListener(\"single-file-network-idle-0\", () => arguments[0](), true)");
 		} else if (options.browserWaitUntil == "networkidle2") {