From e4adea873a288ca65aca267d73958f52d13584fd Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 27 Jan 2022 14:18:29 +0900 Subject: [PATCH] Update chrome.js --- lib/chrome.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/chrome.js b/lib/chrome.js index 9cfaa8f..d21b957 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -14,9 +14,10 @@ var AutoItX = require("lib/autoitx"); // for remote debugging var pageEventId = 0; -var ChromeObject = function() { +var ChromeObject = function(interfaces) { STD.EventableObject.apply(this, arguments); // set this object to `eventable` + this.interfaces = (typeof interfaces !== "undefined" ? interfaces : []); this.vendor = "Chrome"; this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application"; this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe"; @@ -54,9 +55,13 @@ var ChromeObject = function() { this.create = function() { try { - this.oAutoIt = AutoItX.create().getInterface(); + if (this.interfaces.indexOf("autoitx") > -1) { + this.oAutoIt = AutoItX.create().getInterface(); + } else { + console.log("AutoItX is disabled"); + } } catch (e) { - console.warn("AutoItX is disabled"); + console.log("AutoItX is disabled"); } return this; }; @@ -65,7 +70,7 @@ var ChromeObject = function() { if (this.oAutoIt != null) { this.oAutoIt[FN].apply(args); } else { - console.warn("AutoItX is disabled"); + console.log("AutoItX is disabled"); } }; @@ -362,7 +367,7 @@ var ChromeObject = function() { if (this.debuggingPort > 0) { try { var responseText = HTTP.get("http://127.0.0.1:" + this.debuggingPort + "/json"); - //console.info(responseText); + //console.log(responseText); pageList = JSON.parse(responseText); this.pageList = pageList; return pageList; @@ -442,7 +447,7 @@ var ChromeObject = function() { "params": params })); pageEventId++; - console.info("ChromeObject().sendPageRPC() -> Sent"); + console.log("ChromeObject().sendPageRPC() -> Sent"); } else { this.setPageId(null); if (this.pageId != "") { @@ -491,7 +496,7 @@ var ChromeObject = function() { this.getEvaluatedValue = function(expression) { try { var responseText = this.evaluate(expression); - console.info(responseText); + console.log(responseText); var result = JSON.parse(responseText).result.result.value; if (typeof(result) !== "undefined" && result != null) {