Update chrome.js

This commit is contained in:
Namhyeon Go 2022-09-05 14:11:29 +09:00 committed by GitHub
parent b483617070
commit 6810b94a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,21 +54,14 @@ var ChromeObject = function(interfaces) {
this.frameIndex = -1; this.frameIndex = -1;
this.isPreventEvaluate = false; this.isPreventEvaluate = false;
this.isAppMode = true; this.isAppMode = false;
this.baseScreenX = 0; this.baseScreenX = 0;
this.baseScreenY = 0; this.baseScreenY = 0;
this.create = function() { this.create = function() {
this.oAutoIt = AutoIt.create(); this.oAutoIt = AutoIt.create();
this.baseScreenX = 1;
if (!this.isAppMode) { this.baseScreenY = (!this.isAppMode ? 84 : 32);
this.baseScreenX = 1;
this.baseScreenY = 87;
} else {
this.baseScreenX = 1;
this.baseScreenY = 32;
}
return this; return this;
}; };
@ -341,7 +334,7 @@ var ChromeObject = function(interfaces) {
cmd.push("--user-data-dir=\"" + this.userDataDir + "\""); cmd.push("--user-data-dir=\"" + this.userDataDir + "\"");
// choice user agent // choice user agent
if (this.userAgents.length > 0) { if (this.userAgent == null && this.userAgents.length > 0) {
this.setUserAgent(RAND.one(this.userAgents)); this.setUserAgent(RAND.one(this.userAgents));
} }
@ -1206,7 +1199,7 @@ var ChromeObject = function(interfaces) {
this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application"; this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application";
this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe"; this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe";
break; break;
case "chromium": case "chromium":
this.workingDirectory = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application"; this.workingDirectory = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application";
this.binPath = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application\\chrome.exe"; this.binPath = SYS.getEnvString("LOCALAPPDATA") + "\\Chromium\\Application\\chrome.exe";
@ -1258,7 +1251,7 @@ var ChromeObject = function(interfaces) {
this.setValueOfSelectorAll = function(selector, s) { this.setValueOfSelectorAll = function(selector, s) {
this.evaluate('document.querySelectorAll("' + selector + '").forEach(function(x){x.value = "' + s + '";})'); this.evaluate('document.querySelectorAll("' + selector + '").forEach(function(x){x.value = "' + s + '";})');
}; };
this.sendEnterKey = function() { this.sendEnterKey = function() {
this.evaluate('var ev=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13});document.body.dispatchEvent(ev);'); 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) { exports.startDebug = function(url, proxy, profileName, debuggingPort, isPreventProxy) {
return (new ChromeObject()) return (new ChromeObject())
.setProxy(proxy) .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.global = global;
exports.require = global.require; exports.require = global.require;