From 331578452fcec9b76cdb4d788e8416dad9229c41 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 20 Jun 2021 07:05:02 +0900 Subject: [PATCH] Update chrome.js --- lib/chrome.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/chrome.js b/lib/chrome.js index 1bedcf2..b710878 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -223,12 +223,19 @@ var ChromeObject = function() { }; this.sendPageRPC = function(method, params) { - this.ws.send("ws://localhost:" + this.debuggingPort + "/devtools/page/" + this.pageId, JSON.stringify({ - "id": this.pageEventId, - "method": method, - "params": params - })); - this.pageEventId++; + if (this.pageId != "") { + this.ws.send("ws://localhost:" + this.debuggingPort + "/devtools/page/" + this.pageId, JSON.stringify({ + "id": this.pageEventId, + "method": method, + "params": params + })); + this.pageEventId++; + console.info("ChromeObject().sendPageRPC() -> Sent"); + } else { + console.error("pageId not specified"); + } + + return this; }; this.navigate = function(url) {