mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +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.isPreventEvaluate = false;
|
||||
this.isAppMode = true;
|
||||
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;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
@ -305,6 +317,12 @@ var ChromeObject = function(interfaces) {
|
|||
|
||||
// block non-proxyed webrtc traffic
|
||||
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
|
||||
cmd.push("--profile-directory=\"" + this.profileName + "\"");
|
||||
|
@ -328,8 +346,14 @@ var ChromeObject = function(interfaces) {
|
|||
cmd.push("--user-agent=\"" + this.userAgent + "\"");
|
||||
}
|
||||
|
||||
// set URL
|
||||
cmd.push("\"" + url + "\"");
|
||||
// set the URL
|
||||
if (!this.isAppMode) {
|
||||
cmd.push("\"" + url + "\"");
|
||||
} else {
|
||||
cmd.push("--app=\"" + url + "\"");
|
||||
}
|
||||
|
||||
// build the command line
|
||||
console.log(cmd.join(" "));
|
||||
|
||||
// run
|
||||
|
@ -351,14 +375,23 @@ var ChromeObject = function(interfaces) {
|
|||
|
||||
if (this.debuggingPort > 0) {
|
||||
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);
|
||||
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;
|
||||
return pageList;
|
||||
} catch (e) {
|
||||
console.error("ChromeObject.getPageList() ->", e.message);
|
||||
return this.getPageList();
|
||||
//return this.getPageList(); // 무한 루프 문제로 주석처리
|
||||
return pageList; // 바로 넘김
|
||||
}
|
||||
} else {
|
||||
console.error("Remote debugging unavailable");
|
||||
|
@ -1167,12 +1200,12 @@ var ChromeObject = function(interfaces) {
|
|||
};
|
||||
|
||||
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) {
|
||||
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"]);
|
||||
};
|
||||
|
||||
|
@ -1237,7 +1270,7 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i
|
|||
.setUserDataDir(null)
|
||||
.setDebuggingPort(debuggingPort)
|
||||
.setIsPreventProxy(isPreventProxy)
|
||||
.setInPrivate(true)
|
||||
.setInPrivate(true)
|
||||
//.addUserAgentsFromFile("data\\Chrome.txt")
|
||||
//.addUserAgentsFromFile("data\\Edge.txt")
|
||||
//.addUserAgentsFromFile("data\\Safari.txt")
|
||||
|
|
Loading…
Reference in New Issue
Block a user