From 6810b94a22357a657eb1e7f13d00949504a54e48 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 5 Sep 2022 14:11:29 +0900 Subject: [PATCH] Update chrome.js --- lib/chrome.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lib/chrome.js b/lib/chrome.js index 5448731..7944e2b 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -54,21 +54,14 @@ var ChromeObject = function(interfaces) { this.frameIndex = -1; this.isPreventEvaluate = false; - this.isAppMode = true; + this.isAppMode = false; this.baseScreenX = 0; this.baseScreenY = 0; this.create = function() { this.oAutoIt = AutoIt.create(); - - if (!this.isAppMode) { - this.baseScreenX = 1; - this.baseScreenY = 87; - } else { - this.baseScreenX = 1; - this.baseScreenY = 32; - } - + this.baseScreenX = 1; + this.baseScreenY = (!this.isAppMode ? 84 : 32); return this; }; @@ -341,7 +334,7 @@ var ChromeObject = function(interfaces) { cmd.push("--user-data-dir=\"" + this.userDataDir + "\""); // choice user agent - if (this.userAgents.length > 0) { + if (this.userAgent == null && this.userAgents.length > 0) { this.setUserAgent(RAND.one(this.userAgents)); } @@ -1206,7 +1199,7 @@ var ChromeObject = function(interfaces) { this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application"; this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe"; break; - + case "chromium": this.workingDirectory = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application"; this.binPath = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application\\chrome.exe"; @@ -1258,7 +1251,7 @@ var ChromeObject = function(interfaces) { this.setValueOfSelectorAll = function(selector, s) { this.evaluate('document.querySelectorAll("' + selector + '").forEach(function(x){x.value = "' + s + '";})'); }; - + this.sendEnterKey = function() { this.evaluate('var ev=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13});document.body.dispatchEvent(ev);'); }; @@ -1296,6 +1289,17 @@ exports.startWithDebugging = function(url, proxy, profileName, debuggingPort) { ; }; +exports.startWithDebuggingUA = function(url, proxy, profileName, debuggingPort) { + return (new ChromeObject()) + .setProxy(proxy) + .setProfile(profileName, null) + .setUserDataDir(null) + .setDebuggingPort(debuggingPort) + .addUserAgentsFromFile("data\\UserAgents.txt") + .open(url) + ; +}; + exports.startDebug = function(url, proxy, profileName, debuggingPort, isPreventProxy) { return (new ChromeObject()) .setProxy(proxy) @@ -1325,6 +1329,6 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i ; }; -exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4"; +exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.1"; exports.global = global; exports.require = global.require;