mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-10-19 15:20:56 +00:00
Update chrome.js
This commit is contained in:
parent
4b90ce85f5
commit
b33ce602dd
|
@ -362,7 +362,7 @@ var ChromeObject = function() {
|
||||||
|
|
||||||
this.terminate = function() {
|
this.terminate = function() {
|
||||||
try {
|
try {
|
||||||
this.oAutoIt.WinKill(this.pageId);
|
this.oAutoIt.WinKill(this.title);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("ChromeObject.terminate() ->", e.message);
|
console.error("ChromeObject.terminate() ->", e.message);
|
||||||
}
|
}
|
||||||
|
@ -375,12 +375,21 @@ var ChromeObject = function() {
|
||||||
if (this.pageId == "") {
|
if (this.pageId == "") {
|
||||||
this.setPageId(null);
|
this.setPageId(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get current title
|
// get current title
|
||||||
this.title = this.getTitle();
|
this.title = this.getTitle();
|
||||||
|
|
||||||
// _focus()
|
// new title
|
||||||
this._focus();
|
var _title = this.title + " " + this.pageId.substring(0, 6);
|
||||||
|
|
||||||
|
// change webpage title for focusing window
|
||||||
|
this.setTitle(_title);
|
||||||
|
|
||||||
|
// find window by title
|
||||||
|
var pageList = this.getPageList();
|
||||||
|
if (pageList.length > 0) {
|
||||||
|
this.oAutoIt.WinActivate(_title);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("ChromeObject._focus() ->", e.message);
|
console.error("ChromeObject._focus() ->", e.message);
|
||||||
}
|
}
|
||||||
|
@ -391,23 +400,6 @@ var ChromeObject = function() {
|
||||||
this.setTitle(this.title);
|
this.setTitle(this.title);
|
||||||
};
|
};
|
||||||
|
|
||||||
this._focus = function() {
|
|
||||||
if (this.debuggingPort > 0) {
|
|
||||||
try {
|
|
||||||
// change webpage title for focusing window
|
|
||||||
this.setTitle(this.title + " " + this.pageId.substring(0, 6));
|
|
||||||
|
|
||||||
// find window by title
|
|
||||||
var pageList = this.getPageList();
|
|
||||||
if (pageList.length > 0) {
|
|
||||||
this.oAutoIt.WinActivate(this.pageId);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("ChromeObject.focus() ->", e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.getScrollHeight = function(selector) {
|
this.getScrollHeight = function(selector) {
|
||||||
return parseInt(this.getEvaluatedValue('document.querySelector("' + selector + '").scrollHeight'));
|
return parseInt(this.getEvaluatedValue('document.querySelector("' + selector + '").scrollHeight'));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user