cheshirecaat / bas-remote-node Goto Github PK
View Code? Open in Web Editor NEWNodeJS library, which allows you to automate Google Chrome browser.
License: MIT License
NodeJS library, which allows you to automate Google Chrome browser.
License: MIT License
Hello. I experience occasional but quite often error on launch puppeteer-with-fingerprints plugin:
Version: [email protected]
Thread #0 failed: Error: Can't send data because WebSocket is not opened.
at exports.throwIf (C:\bots\test\node_modules\websocket-as-promised\src\utils.js:4:11)
at WebSocketAsPromised.send (C:\bots\test\node_modules\websocket-as-promised\src\index.js:252:5)
at SocketService.send (C:\bots\test\node_modules\bas-remote-node\src\services\socket.js:89:14)
at BasRemoteClient._send (C:\bots\test\node_modules\bas-remote-node\src\index.js:223:25)
at BasRemoteClient.send (C:\bots\test\node_modules\bas-remote-node\src\index.js:254:17)
at BasRemoteClient._startThread (C:\bots\test\node_modules\bas-remote-node\src\index.js:275:10)
at C:\bots\test\node_modules\bas-remote-node\src\index.js:190:12
at new Promise ()
at BasRemoteClient.runFunction (C:\bots\test\node_modules\bas-remote-node\src\index.js:189:21)
at C:\bots\test\node_modules\browser-with-fingerprints\src\plugin\connector\index.js:31:16
What could be a reason?
Pros:
I think, that it would be sufficient to use build in module https://nodejs.org/api/https.html
(node:2532) UnhandledPromiseRejectionWarning: Error: Timeout during client initialize
at Timeout._onTimeout (C:\Users\Administrator\Desktop\mysoft\node_modules\bas-remote-node\lib\index.js:143:48)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
(node:2532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1323)
How fix it?
{
"message": "Cannot connect to the WebSocket server (reason: connection failed)\nThis could be due to the fact that the engine was not downloaded or unpacked correctly.\nTry completely deleting the engine folder and restarting the code until it completes.\nIf this does not help, open an issue with a detailed description of the problem."
}
Please use https://nodejs.org/api/events.html instead.
const options = {
scriptName: 'TestRemoteControl'
};
const client = new BasRemoteClient(options);
await client.start();
var promise1 = client.runFunction('GoogleSearch', {Query: 'cats'});
promise1.Stop(); //stop also doesn't work
await promise1;
await client.close();
Following code will throw exception
UnhandledPromiseRejectionWarning: TypeError: promise1.Stop is not a function
Also, can you rename Stop
method to stop
Execute script provided as quick example
const BasRemoteClient = require('bas-remote-node');
//Set script name, and optionally auth details (login, password)
const options = {
scriptName: 'TestRemoteControl' /* or 'YourScriptName' */
};
//Create client
const scriptClient = new BasRemoteClient(options);
//Start application, this may take some time
await scriptClient.start();
//Set parameters for function
const scriptParams = {
Query: 'cats'
};
//Run function and wait for result
//Following function will return list of strings
const result = await scriptClient.runFunction(
'GoogleSearch', /* or 'YourFunctionName' */
scriptParams);
//Iterate and output results
result.forEach(link => {
console.log(link);
});
await scriptClient.close();
Following error will be thrown:
(node:18544) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rmdir '3afb1'
at Object.rmdirSync (fs.js:684:3)
at fs.readdirSync.map.filter.map.filter.forEach (d:\dev\BASRemoteControl\node\node_modules\bas-remote-node\lib\services\engine.js:104:20)
at Array.forEach (<anonymous>)
at EngineService._clearRunDirectory (d:\dev\BASRemoteControl\node\node_modules\bas-remote-node\lib\services\engine.js:103:14)
at EngineService.start (d:\dev\BASRemoteControl\node\node_modules\bas-remote-node\lib\services\engine.js:45:14)
Please do at least initial testing before releasing/doing commit.
What version of BAS does this use? I don't see anything regarding versions in the readme.
I'm obtaining the following message when I try to proceed the .start() in one of my xmls. I'm not sure what's the reason.
"Script finished with error : SyntaxError: Parse error during execution of action 467148435"
Steps to reproduce:
const scriptClient = new BasRemoteClient({ scriptName: 'YourScriptName' });
await scriptClient.start();
await scriptClient.close();
Actual result:
You will get error
directory not empty, rmdir 'd:\dev\BASRemoteControl\node\data\run\TestRemoteControl\3afb1'
Would be nice to have a linux support
undefined:1
<html>
^
SyntaxError: Unexpected token < in JSON at position 0
at IncomingMessage.<anonymous> (my_program_path\node_modules\bas-remote-node\src\utils.js:29:20)
There are some issues which force close my program when fetching fingerprint using "puppeteer-with-fingerprints"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.