I am a noob to Javascript so apologies if my question is very trivial.
I am trying to run a selenium test that was wrote in Javascript. As I usually do, I just want to start with something simple and work from there. In my script I am just trying to load Google using chromedriver.
var webdriver = require("selenium-webdriver");
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
driver.get("http://www.google.com");
On the CLI I navigate to the directory where the Test.js file is saved in and I run the command node Test.js. I always get this error in response;
C:\Selenium\node_modules\selenium-webdriver\_base.js:104
vm.runInContext(opt_srcText, closure, src);
^
SyntaxError: Unexpected token )
at goog.loadModuleFromSource_ (C:\Selenium\node_modules\selenium-webdriver\l
at Object.goog.loadModule (C:\Selenium\node_modules\selenium-webdriver\lib\g
at C:\Selenium\node_modules\selenium-webdriver\lib\webdriver\promise.js:1:6
at Object.Context.closure.goog.retrieveAndExecModule_ (C:\Selenium\node_modu
at <anonymous>:1:6
at Context.closure.closure.vm.createContext.CLOSURE_IMPORT_SCRIPT (C:\Seleni
at Object.goog.importScript_ (C:\Selenium\node_modules\selenium-webdriver\li
at Object.goog.importModule_ (C:\Selenium\node_modules\selenium-webdriver\li
at Object.goog.writeScripts_ (C:\Selenium\node_modules\selenium-webdriver\li
at Object.goog.require (C:\Selenium\node_modules\selenium-webdriver\lib\goog
I originally ran this code on my Windows machine and when I was getting that error I put it down to Windows and Node.js no agreeing and tried it on my Mac. Still no luck as I was getting the exact same response.
On both machines I have node and npm installed. Previous to executing the tests I ran the command npm install selenium-webdriver and I also added chromedriver to my PATH.
I have no idea what I am doing wrong so if anyone can point me in the right direction, it'd be very much appreciated.
Turns out the version of node I was using was too old.
Thanks to #Louis for your help in reaching this solution.
What I did was uninstall node and re-installed it with the latest version. I would imagine upgrading would work too.
Related
I use Node JS, like everyone else. Everything used to run smoothly. Creating a React App and starting it. But, recently, it has started to give me this error:
C:\Program Files\nodejs\node.exe: OpenSSL configuration error:
48370000:error:8000007B:system library:BIO_new_file:Unknown
error:c:\ws\deps\openssl\openssl\crypto\bio\bss_file.c:67:calling
fopen(D:\openssl-1.0.2j-fips-D:\openssl-1.0.2j-fips-x86_64\OpenSSL\bin\openssl.cnf,
rb)
I am running Windows 11 and have tried everything available on the internet, and ChatGPT. No solution.
A little help maybe?
P.S. I have already tried the already answered question to this but it doesn't work for me
Everything available on the internet
I'm Having an issue that ruins my entire development plans, And I don't think I'm even the problem!
There is an headless CMS program (open source) called Strapi, If you know the program then good, If not, Your more than welcome to try and tell me if you can help me with this problem.
I'm having trouble creating a Strapi app in VSCode.
The error that I'm receiving is:
You are running Node.js 18.4.0
Strapi requires Node.js >=14.19.1 <=16.x.x
Please make sure to use the right version of Node.
But, The fault isn't on me, I have 16.17.0 version of node installed, and without a trace of the 18.4 version specified on the error code.
I tried uninstalling node, Changing the dependencies in the launch.json file, Nothing worked!
So I Found the solution, the problem was with the version, the recommended 16.17.0 version of node not working with strapi, the 16.15.0 works actually.
So i just installed VScode on my Windows 10. I keep getting the following error:
"Can't find Node.js binary "node": path does not exist. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json"
I've tried reinstalling VS and rebooting, tried installing from different folders (both on C drive and the second time i added it to my programs folder)
I tried installing a node.js extension which fails every time and then prompts me to try it manually...which then leads to a file downloading automatically, but when i add it to my VS folder through my file explorer, nothing happens still.
I tried installed a different node.js debugger
I tried changing my debugger to chrome too but all it does is take me to localhost:8080 and an empty page of course.
When i go through file explorer and look through the path of my .vscode folder, the nightly extension (node.js) is there....
I'm new to VScode and have just been using Scrimba's terminal to do my code but decided to try something more professional
I think you're putting node.js in the same folder/path as .vscode, this isn't correct. What you need to do is set node.js in your PATH which is different. See this answer for more information on how to set PATH/environment variables. Also install it from the official website nodejs.org. After changing your PATH remember to reboot.
I wouldn't recommend downloading "node.js extensions" as those likely are not legitimate, and as you've said yourself they don't work. Only download from the official website.
You have to install nodes from this website https://nodejs.org/
I have tried to install meteor js 1.1 on windows 8.1 with the official installer:
https://github.com/meteor/meteor/wiki/Preview-of-Meteor-on-Windows
But even after restarting my computer, when I type the command meteor in the command prompt I get the error command not found.
Even after a search on my computer to find the installation folder of meteor, I am unable to find the answer. However, in the add/remove program utility, I can see meteor.exe.
As a note, I already successfully installed meteor before, and it used to run smoothly. In the meantime, I have removed and re-installed node, and it seems that since this moment the command meteor does not work anymore. Hence my attempt to re-install it.
Does anyone have any idea about how to troubleshoot my issue ?
I just solved my issue by using the windows command prompt instead of the git bash
It appears that only windows command prompt is supported so far.
You can try to manually add Meteor to your Path.
Go to "Environment variables" (you can find it by doing a simple search in your welcome screen) and add the following entry:
C:\\Users\\**your_user_name**\\AppData\\Local\\.meteor
Do not forget to separate this entry from other entries by a semicolon ;.
I'm trying to compile 0.4.7 for Heroku support, but I can't seem to get ssl support working, which express requires.
I've installed libssl-dev, and even tried to install openssl by hand, but nothing seems to get this working. What do I need to do to get node running?
Waf: Leaving directory `/home/skendall/node/node-v0.4.7/build'
Build failed: -> task failed (err #1):
{task: cxx node_crypto.cc -> node_crypto_4.o}
Use v0.4.9 will resolve this issue.
To get node-v0.4.7, or any other version before node-v0.4.12, working with ubuntu 11.10 will involve modifying the source code of node.
Specifically src/node_crypto.cc, which requires the removal of checks for any ssl methods other than sslv1. this section is roughly located around line 100 in the file.
Once done, follow the usual: ./configure; make; make install
This change was tested and worked with express lib, on ubuntu 11.10 with openssl compiled without sslv2.