I am trying to do a mouse click base on position. However, I can't seem to make action work an always get the following message. I reproduced the problem by trying to double click on google.com main search bar.
For help, see: https://nodejs.org/en/docs/inspector
(node:38864) UnhandledPromiseRejectionWarning: UnknownCommandError: Unrecognized command: actions
warning.js:18
at buildRequest (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\http.js:375:9)
at Executor.execute (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\http.js:455:19)
at Driver.execute (c:\GitRepo\MMT4\src\javascript\Web.Tests\node_modules\selenium-webdriver\lib\webdriver.js:696:38)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:38864) 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(). (rejection id: 3)
warning.js:18
(node:38864) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
imported the packages with npm
"devDependencies": {
"#types/node": "^10.12.0"
},
"dependencies": {
"chromedriver": "^2.43.0",
"selenium-webdriver": "^4.0.0-alpha.1"
}
According to the documentation I found here, it should to work
https://seleniumhq.github.io/selenium/docs/api/javascript/index.html
https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/input_exports_Actions.html
Also found different example on web which support it should work, but cannot see what is missing in this basic example:
"use strict";
require('chromedriver');
const { Builder, By, Key, until, ActionSequence } = require('selenium-webdriver');
(async function run() {
let driver = await new Builder().forBrowser('chrome').build();
try {
await driver.get('http://www.google.com');
await driver
.actions()
.doubleClick(By.id('lst-ib'))
.perform();
}
finally {
await driver.quit();
}
})();
Also tested in a project with protractor and it seem to work, but I don't see why I would need protractor in this project since it does not use Angular.
Thanks
I found solution
i tried downgrade selenium-webdriver version 3.6.0
then, maybe it's possible working
and keydown method only 4 ways execute(i need use keyboard!)
key.CONTROL
key.SHIFT
key.ALT
key.COMMAND
so if you need another keyboard action, use sendKeys method(i used Tab key)
here i referenced link
https://github.com/SeleniumHQ/selenium/issues/5428
Related
hope you all are healthy and safe,
so currently I am trying to use video-stitch NPM package for merge couple of videos together so here is my approach
const videoStitch = require("video-stitch");
const videoConcat = videoStitch.concat;
try {
// merge
videoConcat({
silent: false,
})
.clips([
{
fileName:
"E:\\WS\\Projects\\vitok\\videos\\source\\6999919482068077826.mp4",
},
{
fileName:
"E:\\WS\\Projects\\vitok\\videos\\source\\7010852541999205637.mp4",
},
])
.output("test.mp4") //optional absolute file name for output file
.concat()
.then((outputFileName) => {
console.log(`ouput: ${outputFileName}`);
});
} catch (error) {
console.log("error", error);
}
as you can see this is just a test so I am using absolute hard coded paths ..etc this works fine and incredibly fast. until I tried to use this useful function into a Node.js API I just copied same code to a function and hook it into one of my API end points and also made sure all paths are valid but I got this error log
ffmpeg version N-103968-g9fbe54e4b2-20211003 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10-win32 (GCC) 20210408
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20211003
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 10.100 / 59. 10.100
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 11.100 / 8. 11.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0000025e87d6d880] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 # 0000025e87d6d880] moov atom not found
[concat # 0000025e87d6c480] Impossible to open 'E:\\WS\\Projects\\vitok\\videos\\source\\6999919482068077826.mp4'
C:\Users\Abdel\AppData\Local\Temp\tmp-10992iQXU7FqWElTK.txt: Invalid data found when processing input
(node:10992) UnhandledPromiseRejectionWarning: undefined
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10992) 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: 1)
(node:10992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I am not sure what is the problem, but for some reason its not running when I hook it to an API endpoint and works otherwise, I also tried to copy same function and run it when the API starts and it also worked, but when I try to use it in a API end point function it just crashes giving me the error above.
Am I doing anything wrong here? thanks in advance
i'm only trying to launch the exemple of the app kit OrbitDB which is :
import OrbitDB from "orbit-db";
import IPFS from "ipfs";
async function main () {
// Create IPFS instance
const ipfsOptions = { repo : './ipfs', }
const ipfs = await IPFS.create(ipfsOptions)
// Create OrbitDB instance
const orbitdb = await OrbitDB.createInstance(ipfs)
// Create database instance
const db = await orbitdb.keyvalue('ipfs_db')
}
main()
you can find it here : https://github.com/dappkit/aviondb#using-nodejs
but the problem is when i launch it, i got these errors :
Swarm listening on /ip4/127.0.0.1/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/192.168.1.53/tcp/4002/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
Swarm listening on /ip4/127.0.0.1/tcp/4003/ws/p2p/12D3KooWM7D9NdMhtxyiWiKH4XVpuZW5oDu9MbWxFmEzLsG9UynM
IPFSAccessController.save ERROR: Error: Deprecated, use .toString()
at CID.get toBaseEncodedString [as toBaseEncodedString] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/multiformats/cjs/src/cid.js:94:11)
at Object.writeCbor [as write] (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/node_modules/orbit-db-io/index.js:62:14)
at async IPFSAccessController.save (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/ipfs-access-controller.js:46:13)
at async Function.create (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db-access-controllers/src/access-controllers.js:68:20)
at async OrbitDB._determineAddress (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/aviondb/node_modules/orbit-db/src/OrbitDB.js:331:37)
(node:8397) UnhandledPromiseRejectionWarning: Error: `undefined` is not supported by the IPLD Data Model and cannot be encoded
at undefinedEncoder (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:47:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:175:20)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at Object (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:149:9)
at objectToTokens (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:184:10)
at encodeCustom (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:214:18)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/cborg/cjs/lib/encode.js:236:10)
at Object.encode (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/#ipld/dag-cbor/cjs/index.js:85:41)
at put (/home/zar/Etna4/SmartContract/db_ipfs/node_modules/ipfs-core/src/components/dag/put.js:35:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8397) 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: 2)
(node:8397) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
i seriously don't know what to do, i tried to clear the cache, to delete node_modules and package-lock.json, and do a npm install, but nothing changed, i got the same error, do you have any idea to fix this ?
This error clearly points to an incompatibility between IPFS and OrbitDB.
The latest version of js-ipfs that OrbitDB v0.26.1 supports is 0.55.4.
You should change the ipfs (or ipfs-core) version in your package.json to ^0.55.4.
Note: The upcoming OrbitDB v0.27, will support the latest IPFS version.
This question already has answers here:
Why am I getting a ReferenceError: AbortController is not defined in Discord.js v13?
(3 answers)
Closed 1 year ago.
const {Client, Intents} = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.once('ready', () => {
console.log('Ready!');
});
client.login(token);
I have this code, every time i try to run it returns me the same error:
(node:13284) UnhandledPromiseRejectionWarning: ReferenceError:
AbortController is not defined
at RequestHandler.execute (C:\Users\Luis\Vainas\Pruebas\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
at RequestHandler.execute (C:\Users\Luis\Vainas\Pruebas\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
at RequestHandler.push (C:\Users\Luis\Vainas\Pruebas\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
at async WebSocketManager.connect (C:\Users\Luis\Vainas\Pruebas\node_modules\discord.js\src\client\websocket\WebSocketManager.js:128:9)
at async Client.login (C:\Users\Luis\Vainas\Pruebas\node_modules\discord.js\src\client\Client.js:245:7)
(Use node --trace-warnings ... to show where the warning was
created) (node:13284) 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: 2) (node:13284) [DEP0018] DeprecationWarning: Unhandled
promise rejections are deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a
non-zero exit code.
Dont know how to fix it. I tried and investigate on the documentation but cant find the solution.
I've added this line to my code to find the error:
process.on('unhandledRejection', error => {
console.error('Unhandled promise rejection:', error);
});
Getting this:
{ code: 500, method: 'get', path: '/gateway/bot', requestData:
{ json: undefined, files: [] } }
The AbortController package was introduced in Node.js v16 (?). So you need to upgrade your Node.js version. Discord.js v13 requires you to use Node.js v16 and higher as stated in their documentation.
Depending on your operating system, you can either install 64bits or 32bits version of Node.js. Head over to the official website and download 16.8.x (Current, Latest Features) Windows installer.
After installation, verify the version by typing node -v in your console.
I am trying to compile Zig functions to a freestanding WebAssembly module using the wasm32-freestanding target. The official documentation has a section explaining how to do this, but with a recent version of Zig (0.8.0) I get errors when trying to instantiate the resulting module with JavaScript.
// file: main.zig
export fn add(a: i32, b: i32) i32 {
return a +% b;
}
// file: test.js
WebAssembly.instantiate((function() {
const source = require("fs").readFileSync("main.o");
return new Uint8Array(source);
})(), { env: {} }).then(wasm => {
const add = wasm.instance.exports.add;
console.log(add(1, 2));
});
$ zig version
0.8.0
$ node --version
14.17.3
$ zig build-obj main.zig -target wasm32-freestanding -dynamic -OReleaseFast
$ wc -c main.o # the generated code has extension `.o` instead of `.wasm`
135
$ node test.js
(node:2449) UnhandledPromiseRejectionWarning: LinkError: WebAssembly.instantiate(): Import #0 module="env" function="__linear_memory" error: memory import must be a WebAssembly.Memory object
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2449) 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: 1)
(node:2449) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Inspecting the generated wasm module shows that it attempts to import a value called __linear_memory from the scope env. Naturally this fails as I am not providing such an import. However, the example project zig-wasm-test includes a WASM module (compiled with an old version of Zig) which does not include these imports.
What am I doing wrong here? Should I just be providing a __linear_memory export to the module even though it isn't used?
You should try using build-lib instead of build-obj.
I'm using the out-of-the box react native framework to try to build a new app.
i used the following commands ind CMD (Windows 10).
node -v:
v8.12.0
npm -v:
6.4.1
mkdir react-native-workspace
cd react-native-workspace
npm install -g create-react-native-app
create-react-native-app Exercise2
cd Exercise2
npm start
ERROR 12:42 (node:15564) UnhandledPromiseRejectionWarning: Error: jest-haste-map: #providesModule naming collision: Duplicate module
name: my-new-project Paths:
C:\Users\wp_99\Dokumenter\react-native-workspace\Exercise2\package.json
collides with
C:\Users\wp_99\Documents\react-native-workspace\Exercise2\package.json
This error is caused by a #providesModule declaration with the same
name across two different files.
at setModule (C:\Users\wp_99\Documents\react-native-workspace\Exercise2\node_modules\metro\node_modules\jest-haste-map\build\index.js:462:17)
at workerReply (C:\Users\wp_99\Documents\react-native-workspace\Exercise2\node_modules\metro\node_modules\jest-haste-map\build\index.js:512:9)
at
at process._tickCallback (internal/process/next_tick.js:189:7) ERROR 12:42 (node:15564) 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(). (rejection id: 2) (node:15564)
[DEP0018] DeprecationWarning: Unhandled promise rejections are
deprecated. In the future, promise rejections that are not handled
will terminate the Node.js process with a non-zero exit code.
It's a bug in the metro-bundler. You should create rn-cli.config.js and add this configuration to it:
For react-native>=0.57
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
};
react-native < 0.57
const blacklist = require('metro/src/blacklist');
module.exports = {
getBlacklistRE: function() {
return blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
]);
},
};
You can read more here.
I've added the following to rn-cli.config.js
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
};