Update chrome.js

This commit is contained in:
Namhyeon Go 2021-07-28 13:11:26 +09:00 committed by GitHub
parent 85fbab4d3a
commit 77ff042249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,11 +318,12 @@ var ChromeObject = function() {
this.close = function() {
return this.sendPageRPC("Browser.close", {});
};
this.terminate = function() {
var pageList = this.pageList;
for (var i = 0; i < pageList.length; i++) {
this.oAutoIt.WinKill(pageList[i].title);
try {
this.oAutoIt.WinKill(this.pageId);
} catch (e) {
console.error("ChromeObject.terminate() -> " + e.message);
}
};
@ -338,7 +339,7 @@ var ChromeObject = function() {
// change webpage title to original
this.setTitle(_title);
} catch (e) {
console.error("ChromeObject.focus() -> " + e.message);
console.error("ChromeObject._focus() -> " + e.message);
}
}
};
@ -506,11 +507,15 @@ var ChromeObject = function() {
this.reload = function() {
return this.sendPageRPC("Page.reload", {});
};
this.hasClass = function(selector, className) {
var result = this.getEvaluatedValue('document.querySelector(".html5-video-player").getAttribute("class")');
var classNames = result.split(' ');
return (classNames.indexOf(className) > -1);
if (result) {
var classNames = result.split(' ');
return (classNames.indexOf(className) > -1);
} else {
return false;
}
};
this.create();