Description
Hello:
I happen to find this great repo., and I want to know if I can use it to run some Node.js script, in which npm package ‘chrome-remote-interface’ is used.
The following is my situation:
My OS: Windows 10 (latest version)
Node.js: version 15.9.0 (rather new version, even the current version is: 15.10.0)
I installed Google Chrome in my Windows PC (Version 88.0.4324.190)
I run chrome with this command: chrome --remote-debugging-port=9222
I have installed the following npm packages:
C:\Temp>type package.json
{
"name": "Test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"chrome-remote-interface": "^0.29.0",
"express": "^4.17.1",
"node-fetch": "^2.6.1",
}
}
The following is the content for index.js:
C:\Temp>type index.js
const CDP = require('chrome-remote-interface');
CDP(async(client) => {
const {Network, Page, Runtime} = client;
try {
await Network.enable();
await Page.enable();
await Network.setCacheDisabled({cacheDisabled: true});
await Page.navigate({url: 'https://www.google.com/'});
await Page.loadEventFired();
const result = await Runtime.evaluate({
expression: 'document.documentElement.outerHTML'
});
const html = result.result.value;
console.log(html);
} catch (err) {
console.error(err);
} finally {
client.close();
}
}).on('error', (err) => {
console.error(err);
});
I can run my Node.js script (index.js) without any issue:
C:\Temp> node index.js
My question is: how I can do the same with Jering.Javascript.NodeJS?
I have downloaded the repo in zip format, and unzip it and tried to understand it.
I am using Visual Studio 2019 (Version 16.8.6), when I tried to rebuild the repo., I got 8 errors:
Error NU1403 Package content hash validation failed for Microsoft.DotNet.PlatformAbstractions.2.1.0. The package is different than the last restore.
Package content hash validation failed for Microsoft.NETCore.Platforms.2.0.0. The package is different than the last restore.
Package content hash validation failed for Microsoft.NETCore.Targets.1.1.0. The package is different than the last restore.
Package content hash validation failed for runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl.4.3.0. The package is different than the last restore.
Package content hash validation failed for runtime.native.System.4.3.0. The package is different than the last restore.
…..
I wish I can port this repo to target .Net 5.0, which will be the future for all .Net platform.
But I don’t know how to fix those above errors first.
Besides, I looked at the repo., I have no idea how I can set up one small test case, so I can test my Node.js script: index.js
Please advise!