Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auto-chrome

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-chrome - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

test/index.js

4

lib/Chrome.js

@@ -43,5 +43,5 @@ "use strict"

// 建立last副本,防止关闭所有标签时浏览器自动退出
let [...pages] = this.pages
let [page, ...pages] = this.pages
await this.newPage()
this.page = page[1]

@@ -48,0 +48,0 @@ let list = []

@@ -121,4 +121,8 @@ "use strict"

if (!this.page) {
this.isNav = true
let { page } = this
if (!page) {
await this.loadPage()

@@ -130,5 +134,5 @@

let { page } = this
let { sessionId, contextId, ctxTime } = page
if (!page.sessionId) {
if (!sessionId) {

@@ -141,3 +145,3 @@ await this.loadPage()

if (!page.contextId) {
if (!contextId) {

@@ -153,4 +157,2 @@ await Promise.all([

let { contextId } = page
// 循环监测

@@ -164,6 +166,17 @@ for (let i = 1; i <= (delay / 100); i++) {

if (contextId !== page.contextId) {
if (ctxTime !== page.ctxTime) {
await page.waitLoad()
ctxTime = page.ctxTime
// url跳转监测
for (let i = 1; i <= (6 / 100); i++) {
await sleep(100)
if (ctxTime !== page.ctxTime) break
}
await this.page.loadPromise
return

@@ -178,14 +191,4 @@

let list = []
this.autoLoad()
if (!this.page.contextId) {
list.push(this.page.waitCtx())
}
list.push(this.page.waitLoad())
await Promise.all(list)
return

@@ -197,4 +200,12 @@

this.isNav = false
}
/**
* 循环监测导航
*/
loopWatch() {
}
/**
* 关闭标签后,等待标签自动切换

@@ -201,0 +212,0 @@ */

@@ -35,3 +35,3 @@ "use strict"

}
return result

@@ -41,2 +41,4 @@

logger.error(error)
}

@@ -52,18 +54,26 @@

let { result } = await this.page.send('Runtime.evaluate', {
contextId: this.page.contextId,
returnByValue: false,
awaitPromise: true,
userGesture: true,
...options
})
try {
let { className, subtype, description } = result
let { result } = await this.page.send('Runtime.evaluate', {
contextId: this.page.contextId,
returnByValue: false,
awaitPromise: true,
userGesture: true,
...options
})
if (className === 'TypeError' || subtype === 'error') {
logger.error(new Error(description))
let { className, subtype, description } = result
if (className === 'TypeError' || subtype === 'error') {
logger.error(new Error(description))
}
return result
} catch (error) {
logger.error(error)
}
return result
}

@@ -70,0 +80,0 @@ }

@@ -117,5 +117,9 @@ "use strict"

this.element.objectId = null
this.ctxTime = Date.now()
this.ctxPromise.resolve()
this.waitLoad()
}

@@ -142,3 +146,2 @@

this.loadPromise.resolve()
logger.success("页面加载完毕")
}

@@ -145,0 +148,0 @@

{
"name": "auto-chrome",
"version": "0.10.1",
"version": "0.10.2",
"description": "使用Node.js操作Chrome或Chromium,高仿真的用户行为模拟器",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -64,2 +64,4 @@ # auto-chrome

另外一种情况是由于url重定向,频繁的触发上下文切换,导致上下文错位。这种场景难以被察觉,也很难做预判。
#### 可预测导航

@@ -66,0 +68,0 @@

@@ -16,3 +16,3 @@ const autoChrome = require('../../')

let [page] = await browser.pages()
let [page] = browser.pages

@@ -19,0 +19,0 @@ // await page.setViewport({

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc