Update chrome.js

This commit is contained in:
Namhyeon Go 2021-07-30 03:22:15 +09:00 committed by GitHub
parent 7239d3866d
commit d5c2a0dd2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -511,15 +511,26 @@ var ChromeObject = function() {
return this.sendPageRPC("Page.reload", {});
};
this.hasClass = function(selector, className) {
var result = this.getEvaluatedValue('document.querySelector(".html5-video-player").getAttribute("class")');
if (result) {
var classNames = result.split(' ');
return (classNames.indexOf(className) > -1);
} else {
return false;
this.hasClass = function(seletctor, className) {
try {
var result = this.getEvaluatedValue('document.querySelector(".html5-video-player").getAttribute("class")');
if (typeof(result) === "string") {
return (result.split(' ').indexOf(className) > -1);
} else {
return false;
}
} catch (e) {
console.error("ChromeObject.hasClass() -> " + e.message);
}
};
this.getAttribute = function(selector, attributeName) {
return this.getEvaluatedValue('document.querySelector("' + selector + '").getAttribute("' + attributeName + '")');
};
this.sendSpaceKey = function() {
this.oAutoIt.Send("{SPACE}");
};
this.create();
};