mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-03-12 08:55:14 +00:00
Update chrome.js
This commit is contained in:
parent
4b90ce85f5
commit
b33ce602dd
|
@ -362,7 +362,7 @@ var ChromeObject = function() {
|
|||
|
||||
this.terminate = function() {
|
||||
try {
|
||||
this.oAutoIt.WinKill(this.pageId);
|
||||
this.oAutoIt.WinKill(this.title);
|
||||
} catch (e) {
|
||||
console.error("ChromeObject.terminate() ->", e.message);
|
||||
}
|
||||
|
@ -375,12 +375,21 @@ var ChromeObject = function() {
|
|||
if (this.pageId == "") {
|
||||
this.setPageId(null);
|
||||
}
|
||||
|
||||
|
||||
// get current title
|
||||
this.title = this.getTitle();
|
||||
|
||||
// _focus()
|
||||
this._focus();
|
||||
// new title
|
||||
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) {
|
||||
console.error("ChromeObject._focus() ->", e.message);
|
||||
}
|
||||
|
@ -391,23 +400,6 @@ var ChromeObject = function() {
|
|||
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) {
|
||||
return parseInt(this.getEvaluatedValue('document.querySelector("' + selector + '").scrollHeight'));
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user