Update chrome.js

This commit is contained in:
Namhyeon Go 2021-08-11 16:31:27 +09:00 committed by GitHub
parent 4b90ce85f5
commit b33ce602dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'));
};