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
94787a1305
commit
6c182739f2
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user