simonradier / node-red-contrib-simple-webdriver

SimpleWebdriver nodes for Node-RED initially based on node-red-contrib-selenium-wd2
Apache License 2.0
14 stars 7 forks source link

Node "Run script" error when running any script #46

Closed eekcodeman closed 9 months ago

eekcodeman commented 9 months ago

Hi, please help me.

(node-red and node-red-contrib-simple-webdriver last version)

Any script causes crash in node-red.

Error: 7 Oct 12:32:40 - [red] Uncaught Exception: 7 Oct 12:32:40 - [error] TypeError: Cannot read properties of undefined (reading '0') at C:\Users\User\.node-red\node_modules\node-red-contrib-simple-webdriver\dist\utils\mode-execute.js:22:56 at Observable._subscribe (C:\Users\User\.node-red\node_modules\node-red-contrib-simple-webdriver\dist\utils\mode-execute.js:73:11) at Observable._trySubscribe (C:\Users\User\.node-red\node_modules\rxjs\dist\cjs\internal\Observable.js:41:25) at C:\Users\User\.node-red\node_modules\rxjs\dist\cjs\internal\Observable.js:35:31 at Object.errorContext (C:\Users\User\.node-red\node_modules\rxjs\dist\cjs\internal\util\errorContext.js:22:9) at Observable.subscribe (C:\Users\User\.node-red\node_modules\rxjs\dist\cjs\internal\Observable.js:26:24) at C:\Users\User\.node-red\node_modules\node-red-contrib-simple-webdriver\dist\nodes\run-script.js:34:12 at new Promise () at inputAction (C:\Users\User\.node-red\node_modules\node-red-contrib-simple-webdriver\dist\nodes\run-script.js:8:12) at Object.complete (C:\Users\User\.node-red\node_modules\node-red-contrib-simple-webdriver\dist\nodes\node-constructor.js:114:43)

image

simonradier commented 9 months ago

Hi,

Could you provide me a full flow example plz?

What is the browser you are using?

Regards,

eekcodeman commented 9 months ago

Hi, I'm using Chrome .

Steps: drag Inject (without parameters) drag Open Browser drag Run Script Action: click Inject -> Open Browser -> Load Page -> Error close node-red

Flow: [{"id":"e9f1e42a4e405c2c","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"6f8d6888506910e1","type":"open browser","z":"e9f1e42a4e405c2c","name":"","browserType":"chrome","webURL":"https://www.google.com.br","width":1280,"height":1024,"timeout":3000,"maximized":true,"headless":false,"args":[],"serverURL":"http://localhost:4444","x":130,"y":100,"wires":[["044004be936df7b2"]]},{"id":"044004be936df7b2","type":"run script","z":"e9f1e42a4e405c2c","name":"","script":"console.log('test');","selector":"","target":"","mode":"first","timeout":1000,"waitFor":500,"x":130,"y":160,"wires":[[],[]]},{"id":"7ca2d25e92438c67","type":"inject","z":"e9f1e42a4e405c2c","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":40,"wires":[["6f8d6888506910e1"]]}]

Regards,

simonradier commented 9 months ago

Hi,

I found the issue. It is because (before the 0.3.1 patch), it was expected an element in input and was failing if none was provided (it was pushed as an argument to the script). I added a check to avoid this error.

Please update to 0.3.1 and let me know if it works.

Regards,

eekcodeman commented 9 months ago

Test ok! thank you so much!!!

image