auto-chrome
Advanced tools
Comparing version 0.4.10 to 0.5.0
@@ -6,1 +6,5 @@ ## 版本更新 | ||
* 默认时间微调 | ||
#### 0.5.0 | ||
* 增加page.goBack()、page.goForward() |
@@ -6,3 +6,3 @@ "use strict" | ||
const { Keyboard, Mouse, Touch } = require('./Input'); | ||
const { logger } = require('./helper'); | ||
const { logger } = require('./helper'); | ||
@@ -69,2 +69,29 @@ class Page extends Message { | ||
/** | ||
* 返回上一个历史页 | ||
*/ | ||
async goBack() { | ||
return this.go(-1); | ||
} | ||
/** | ||
* 返回下一个历史页 | ||
*/ | ||
async goForward() { | ||
return this.go(1) | ||
} | ||
/** | ||
* 返回指定的历史页面 | ||
* @param {*} index | ||
*/ | ||
async go(index) { | ||
const history = await this.send('Page.getNavigationHistory') | ||
const entry = history.entries[history.currentIndex + index]; | ||
if (!entry) return | ||
await this.send('Page.navigateToHistoryEntry', { entryId: entry.id }) | ||
} | ||
/** | ||
* 注入包含参数的JS函数,并获取返回值 | ||
@@ -71,0 +98,0 @@ * @param {Function} func |
{ | ||
"name": "auto-chrome", | ||
"version": "0.4.10", | ||
"version": "0.5.0", | ||
"description": "使用Node.js操作Chrome或Chromium,高仿真的用户行为模拟器", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -262,4 +262,11 @@ # auto-chrome | ||
#### page.goBack() | ||
导航到上一个历史标签页 | ||
#### page.goForward() | ||
导航到下一个历史标签页 | ||
### class: Element | ||
@@ -266,0 +273,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
573402
51
2947
391