mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 21:51:04 +00:00
Update chrome.js
This commit is contained in:
parent
94787a1305
commit
6c182739f2
|
@ -161,7 +161,6 @@ var ChromeObject = function() {
|
||||||
if (!this.userDataDir) {
|
if (!this.userDataDir) {
|
||||||
this.userDataDir = SHELL.getPathOfMyDocuments() + "\\UserData_Chrome_" + this.profileName;
|
this.userDataDir = SHELL.getPathOfMyDocuments() + "\\UserData_Chrome_" + this.profileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var shell = SHELL.create().setWorkingDirectory(this.workingDirectory);
|
var shell = SHELL.create().setWorkingDirectory(this.workingDirectory);
|
||||||
var process = shell.createProcess([
|
var process = shell.createProcess([
|
||||||
"\"" + this.binPath + "\"",
|
"\"" + 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() {
|
this.focusWithoutActivate = function() {
|
||||||
if (this.debuggingPort > 0) {
|
if (this.debuggingPort > 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -464,10 +467,20 @@ var ChromeObject = function() {
|
||||||
var page = this.getPageById(this.pageId);
|
var page = this.getPageById(this.pageId);
|
||||||
return page.url;
|
return page.url;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.triggerEvent = function(eventName, selector) {
|
this.triggerEvent = function(eventName, selector) {
|
||||||
return this.evaluate('document.querySelector("' + selector + '").dispatchEvent(new Event("' + eventName + '"))');
|
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();
|
this.create();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user