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.6.3 to 0.6.4

37

lib/Element.js

@@ -101,2 +101,11 @@ "use strict"

/**
* 创建新的Element实例
* @param {Object} remote 远程资源对象
*/
create(objectId) {
return new Element(this.page, { objectId })
}
/**
* CSS单选迭代选择器

@@ -107,4 +116,3 @@ * @param {String} selector

// 子查询
let { objectId, className, description } = await this.evaluate({
let remote = await this.evaluate({
func: (element, selector) => element.querySelector(selector),

@@ -114,4 +122,6 @@ args: [{ value: selector }]

let { objectId, className, description } = remote
if (className === 'TypeError') {
logger.error(new Error(description))
logger.warn(new Error(description))
return

@@ -123,3 +133,3 @@ }

// 创建新的子节点实例
return new Element(this.page, { objectId })
return this.create(objectId)

@@ -149,6 +159,7 @@ }

// 批量创建子节点实例
for (let item of result) {
if (item.enumerable === true) {
// 批量创建子节点实例
let element = new Element(this.page, item.value)
let { enumerable, value } = item
if (enumerable === true) {
let element = this.create(value.objectId)
elements.push(element)

@@ -186,3 +197,3 @@ }

return await this.evaluate({
let { value } = await this.evaluate({
args: [{ value: name }, { value }],

@@ -194,5 +205,7 @@ func: (element, name, value) => {

return value
}
/**
* 获取或设置值
* 获取或设置值,仅适用于input元素
* @param {*} selector

@@ -203,3 +216,3 @@ */

if (value) {
return await this.evaluate({
var result = await this.evaluate({
func: (element, value) => { element.value = value },

@@ -209,3 +222,3 @@ args: [{ value }]

} else {
return await this.evaluate({
var result = await this.evaluate({
func: element => element.value

@@ -215,2 +228,4 @@ })

return result.value
}

@@ -217,0 +232,0 @@ /**

@@ -176,2 +176,4 @@ "use strict"

return element
}

@@ -178,0 +180,0 @@

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

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

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