mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
Update chrome.js
This commit is contained in:
parent
dc93f4b987
commit
e1df66f6f7
|
@ -53,9 +53,21 @@ var ChromeObject = function(interfaces) {
|
||||||
this.frameIndex = -1;
|
this.frameIndex = -1;
|
||||||
|
|
||||||
this.isPreventEvaluate = false;
|
this.isPreventEvaluate = false;
|
||||||
|
this.isAppMode = true;
|
||||||
|
this.baseScreenX = 0;
|
||||||
|
this.baseScreenY = 0;
|
||||||
|
|
||||||
this.create = function() {
|
this.create = function() {
|
||||||
this.oAutoIt = AutoIt.create();
|
this.oAutoIt = AutoIt.create();
|
||||||
|
|
||||||
|
if (!this.isAppMode) {
|
||||||
|
this.baseScreenX = 1;
|
||||||
|
this.baseScreenY = 87;
|
||||||
|
} else {
|
||||||
|
this.baseScreenX = 1;
|
||||||
|
this.baseScreenY = 32;
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -305,6 +317,12 @@ var ChromeObject = function(interfaces) {
|
||||||
|
|
||||||
// block non-proxyed webrtc traffic
|
// block non-proxyed webrtc traffic
|
||||||
cmd.push("--force-webrtc-ip-handling-policy=disable-non-proxied-udp");
|
cmd.push("--force-webrtc-ip-handling-policy=disable-non-proxied-udp");
|
||||||
|
|
||||||
|
// disable session crashed bubble (
|
||||||
|
//cmd.push("--disable-session-crashed-bubble");
|
||||||
|
|
||||||
|
// enable restore the last session
|
||||||
|
//cmd.push("--restore-last-session");
|
||||||
|
|
||||||
// set profile directory
|
// set profile directory
|
||||||
cmd.push("--profile-directory=\"" + this.profileName + "\"");
|
cmd.push("--profile-directory=\"" + this.profileName + "\"");
|
||||||
|
@ -328,8 +346,14 @@ var ChromeObject = function(interfaces) {
|
||||||
cmd.push("--user-agent=\"" + this.userAgent + "\"");
|
cmd.push("--user-agent=\"" + this.userAgent + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// set URL
|
// set the URL
|
||||||
cmd.push("\"" + url + "\"");
|
if (!this.isAppMode) {
|
||||||
|
cmd.push("\"" + url + "\"");
|
||||||
|
} else {
|
||||||
|
cmd.push("--app=\"" + url + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
// build the command line
|
||||||
console.log(cmd.join(" "));
|
console.log(cmd.join(" "));
|
||||||
|
|
||||||
// run
|
// run
|
||||||
|
@ -351,14 +375,23 @@ var ChromeObject = function(interfaces) {
|
||||||
|
|
||||||
if (this.debuggingPort > 0) {
|
if (this.debuggingPort > 0) {
|
||||||
try {
|
try {
|
||||||
var responseText = HTTP.get("http://127.0.0.1:" + this.debuggingPort + "/json");
|
//var responseText = HTTP.get("http://127.0.0.1:" + this.debuggingPort + "/json");
|
||||||
//console.log(responseText);
|
//console.log(responseText);
|
||||||
pageList = JSON.parse(responseText);
|
//pageList = JSON.parse(responseText);
|
||||||
|
|
||||||
|
var pageList = HTTP.create("CURL")
|
||||||
|
.setDataType("json")
|
||||||
|
.open("GET", "http://127.0.0.1:" + this.debuggingPort + "/json")
|
||||||
|
.send()
|
||||||
|
.responseBody
|
||||||
|
;
|
||||||
|
|
||||||
this.pageList = pageList;
|
this.pageList = pageList;
|
||||||
return pageList;
|
return pageList;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("ChromeObject.getPageList() ->", e.message);
|
console.error("ChromeObject.getPageList() ->", e.message);
|
||||||
return this.getPageList();
|
//return this.getPageList(); // 무한 루프 문제로 주석처리
|
||||||
|
return pageList; // 바로 넘김
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("Remote debugging unavailable");
|
console.error("Remote debugging unavailable");
|
||||||
|
@ -1167,12 +1200,12 @@ var ChromeObject = function(interfaces) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.vMouseClick = function(x, y) {
|
this.vMouseClick = function(x, y) {
|
||||||
Toolkit.sendClick(this.pageId.substring(0, 6), x, y, 1);
|
Toolkit.sendClick(this.pageId.substring(0, 6), this.baseScreenX + x, this.baseScreenY + y, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.mouseClick = function(x, y) {
|
this.mouseClick = function(x, y) {
|
||||||
var screenPosition = this.getScreenPosition();
|
var screenPosition = this.getScreenPosition();
|
||||||
this.oAutoIt.callFunction("MouseMove", [screenPosition.x + x, screenPosition.y + y]);
|
this.oAutoIt.callFunction("MouseMove", [screenPosition.x + this.baseScreenX + x, screenPosition.y + this.baseScreenY + y]);
|
||||||
this.oAutoIt.callFunction("MouseClick", ["left"]);
|
this.oAutoIt.callFunction("MouseClick", ["left"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1237,7 +1270,7 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i
|
||||||
.setUserDataDir(null)
|
.setUserDataDir(null)
|
||||||
.setDebuggingPort(debuggingPort)
|
.setDebuggingPort(debuggingPort)
|
||||||
.setIsPreventProxy(isPreventProxy)
|
.setIsPreventProxy(isPreventProxy)
|
||||||
.setInPrivate(true)
|
.setInPrivate(true)
|
||||||
//.addUserAgentsFromFile("data\\Chrome.txt")
|
//.addUserAgentsFromFile("data\\Chrome.txt")
|
||||||
//.addUserAgentsFromFile("data\\Edge.txt")
|
//.addUserAgentsFromFile("data\\Edge.txt")
|
||||||
//.addUserAgentsFromFile("data\\Safari.txt")
|
//.addUserAgentsFromFile("data\\Safari.txt")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user