mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Update chrome.js
This commit is contained in:
parent
4f6a3a1e50
commit
e4adea873a
|
@ -14,9 +14,10 @@ var AutoItX = require("lib/autoitx");
|
|||
// for remote debugging
|
||||
var pageEventId = 0;
|
||||
|
||||
var ChromeObject = function() {
|
||||
var ChromeObject = function(interfaces) {
|
||||
STD.EventableObject.apply(this, arguments); // set this object to `eventable`
|
||||
|
||||
this.interfaces = (typeof interfaces !== "undefined" ? interfaces : []);
|
||||
this.vendor = "Chrome";
|
||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application";
|
||||
this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe";
|
||||
|
@ -54,9 +55,13 @@ var ChromeObject = function() {
|
|||
|
||||
this.create = function() {
|
||||
try {
|
||||
if (this.interfaces.indexOf("autoitx") > -1) {
|
||||
this.oAutoIt = AutoItX.create().getInterface();
|
||||
} else {
|
||||
console.log("AutoItX is disabled");
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("AutoItX is disabled");
|
||||
console.log("AutoItX is disabled");
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
@ -65,7 +70,7 @@ var ChromeObject = function() {
|
|||
if (this.oAutoIt != null) {
|
||||
this.oAutoIt[FN].apply(args);
|
||||
} else {
|
||||
console.warn("AutoItX is disabled");
|
||||
console.log("AutoItX is disabled");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -362,7 +367,7 @@ var ChromeObject = function() {
|
|||
if (this.debuggingPort > 0) {
|
||||
try {
|
||||
var responseText = HTTP.get("http://127.0.0.1:" + this.debuggingPort + "/json");
|
||||
//console.info(responseText);
|
||||
//console.log(responseText);
|
||||
pageList = JSON.parse(responseText);
|
||||
this.pageList = pageList;
|
||||
return pageList;
|
||||
|
@ -442,7 +447,7 @@ var ChromeObject = function() {
|
|||
"params": params
|
||||
}));
|
||||
pageEventId++;
|
||||
console.info("ChromeObject().sendPageRPC() -> Sent");
|
||||
console.log("ChromeObject().sendPageRPC() -> Sent");
|
||||
} else {
|
||||
this.setPageId(null);
|
||||
if (this.pageId != "") {
|
||||
|
@ -491,7 +496,7 @@ var ChromeObject = function() {
|
|||
this.getEvaluatedValue = function(expression) {
|
||||
try {
|
||||
var responseText = this.evaluate(expression);
|
||||
console.info(responseText);
|
||||
console.log(responseText);
|
||||
|
||||
var result = JSON.parse(responseText).result.result.value;
|
||||
if (typeof(result) !== "undefined" && result != null) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user