mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update chrome.js
This commit is contained in:
parent
85fbab4d3a
commit
77ff042249
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user