Update chrome.js

This commit is contained in:
Namhyeon Go 2021-07-25 20:56:56 +09:00 committed by GitHub
parent 94787a1305
commit 6c182739f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,7 +161,6 @@ var ChromeObject = function() {
if (!this.userDataDir) {
this.userDataDir = SHELL.getPathOfMyDocuments() + "\\UserData_Chrome_" + this.profileName;
}
var shell = SHELL.create().setWorkingDirectory(this.workingDirectory);
var process = shell.createProcess([
"\"" + this.binPath + "\"",
@ -340,7 +339,11 @@ var ChromeObject = function() {
}
}
};
this.scrollToBottom = function() {
return this.evaluate('window.scrollTo(0, document.body.scrollHeight || document.documentElement.scrollHeight)');
};
this.focusWithoutActivate = function() {
if (this.debuggingPort > 0) {
try {
@ -464,10 +467,20 @@ var ChromeObject = function() {
var page = this.getPageById(this.pageId);
return page.url;
};
this.triggerEvent = function(eventName, selector) {
return this.evaluate('document.querySelector("' + selector + '").dispatchEvent(new Event("' + eventName + '"))');
};
this.scrollBy = function(dx, dy) {
var dx = (typeof(dx) !== "undefined" ? dx : '0');
var dy = (typeof(dy) !== "undefined" ? dy : '0');
return this.evaluate('window.scrollBy(' + dx + ', ' + dy + ')');
};
this.reload = function() {
return this.sendPageRPC("Page.reload", {});
};
this.create();
};