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.11.11 to 0.11.12

23

lib/Chrome.js

@@ -5,14 +5,21 @@ "use strict";

const ChromeEvent = require('./ChromeEvent.js');
const helper = require('./helper.js');
const { sleep } = helper;
class Chrome extends ChromeEvent {
/**
* @param {Object} ws WebSocket实例
* @param {Boolean} ignoreHTTPSErrors 是否忽略https错误
* @param {Object} args.ws WebSocket实例
* @param {Boolean} args.process 子进程chrome实例
* @param {Boolean} args.options.ignoreHTTPSErrors 是否忽略https错误
* @param {Boolean} args.options.emulate 设备仿真配置
*/
constructor(ws, ignoreHTTPSErrors = true, emulate = {}) {
constructor(args) {
const { ws, options, process } = args;
super(ws);
this.options = options;
this.process = process;
const { ignoreHTTPSErrors, emulate } = options;
this.ignoreHTTPSErrors = ignoreHTTPSErrors;

@@ -116,8 +123,6 @@ this.emulate = emulate;

await this.send('Browser.close');
// await this.send('Browser.close');
this.process.kill();
await sleep(1200);
}

@@ -124,0 +129,0 @@ }

"use strict";
const logger = require('loggercc');
const timeChain = require('timechain');

@@ -5,0 +4,0 @@ const timerPromise = require('zpromise/timer.js');

@@ -78,5 +78,7 @@ "use strict";

let ws;
try {
var ws = new WebSocket(webSocketUrl, { perMessageDeflate: false });
ws = new WebSocket(webSocketUrl, { perMessageDeflate: false });

@@ -104,12 +106,10 @@ } catch (error) {

const { ignoreHTTPSErrors, emulate } = options;
const chrome = new Chrome({
ws,
options,
process: chromeProcess,
});
const chrome = new Chrome(ws, ignoreHTTPSErrors, emulate);
ws.on('message', chrome.message.bind(chrome));
chrome.options = options;
chrome.process = chromeProcess;
await chrome.init();

@@ -116,0 +116,0 @@

@@ -24,2 +24,3 @@ "use strict"

async down(key, options = { text: undefined }) {
const description = this.keyDescriptionForString(key);

@@ -32,2 +33,3 @@

const text = options.text === undefined ? description.text : options.text;
await this.send('Input.dispatchKeyEvent', {

@@ -45,2 +47,3 @@ type: text ? 'keyDown' : 'rawKeyDown',

});
}

@@ -181,2 +184,2 @@

module.exports = Keyboard
module.exports = Keyboard;

@@ -1,2 +0,2 @@

"use strict"
"use strict";

@@ -34,3 +34,3 @@ const logger = require('loggercc');

let { viewport, geolocation } = options
const { viewport, geolocation } = options;

@@ -48,5 +48,5 @@ if (viewport) {

if (viewport.mobile) {
this.clicker = this.touch
this.clicker = this.touch;
} else {
this.clicker = this.mouse
this.clicker = this.mouse;
}

@@ -56,3 +56,3 @@

this.clicker = this.mouse
this.clicker = this.mouse;

@@ -62,3 +62,3 @@ }

if (geolocation) {
await this.send('Emulation.setGeolocationOverride', geolocation)
await this.send('Emulation.setGeolocationOverride', geolocation);
}

@@ -72,3 +72,3 @@

let result = await Promise.all([
const result = await Promise.all([
this.send('Page.navigate', { url }),

@@ -75,0 +75,0 @@ this.chrome.autoLoad(2000)

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

@@ -5,0 +5,0 @@ "main": "lib/",

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