Error running 'webdriver-manager start' on Windows 8.1 - java

I am attempting to run end-to-end test for an angular project using protractor and am getting the following error when I run the command 'webdriver-manager start'
I have run webdriver-manager update, and selenium standalone and chromedriver are up to date.
I have java installed. java -version returns
I also have the path to java in my system environment variables (C:\Program Files\Java\jre1.8.0_31\bin)
Does anyone have any idea how to fix this error?

You can also start the web driver as below,
java -Dwebdriver.ie.driver=D:\Selenium_download_New\IEDriverServer.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
java -Dwebdriver.chrome.driver=D:\Selenium_download_New\chromedriver.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
Note the Standalone.jar should be placed in the exact location as above, you can also download the standalone.jar from selenium website

I had the same issue. Probably the webdriver update you are running is installing Selenium required files in another folder that it isn't inside your project folder. At least that was my case.
I was using a grunt task for running Protractor tests. If you are using the same plugin check this folder:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\selenium
If you don't find that folder then you are under the same issue as me. Try with another bash. You're using cmd, try with Git Bash. Locate yourself in the following directory:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\bin
Then run:
webdriver-manager update
Finally check the selenium folder inside your Protractor plugin. It should be created now.
I didn't have time to find why cmd is behaving different than Git Bash when running the same command inside the same folder. Each one installs the Selenium files in different places.

Maybe you are missing a system variable(C:\Windows\System32\ variable.). Adding this variable would solve your problem.
Hope, it helps!

Add "C:\Windows\System32\" to your PATHs.
On windows, right-click My Computer -> Properties -> Advanced system settings -> Environment Variables -> Edit... PATH and add "C:\Windows\System32\" to the end (with a semi-colon separating each variable).
Otherwise
SET PATH=%PATH%;C:\Windows\System32
Then start web driver using below command
webdriver-manager start

SPAWN command is not available in windows.
Install git. git bash will be installed too.
Now add git bash path to the PATH environment variable.
Restart your command prompt and it will run.

Related

VS Code Showing 'mvn' is not recognized as an internal or external command

I'm trying to create a maven project with VS Code but when I run the command it says :
'mvn' is not recognized as an internal or external command,operable program or batch file.
but mvn -version is running on command prompt
Environment varaible for User :
MAVEN_JOME : C:\apache-maven-3.6.1,
M2_HOME : C:\apache-maven-3.6.1,
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_212\jre and
System Variables
path is set to C:\apache-maven-3.6.1\bin, C:\Program Files\Java\jdk1.8.0_212\bin for maven and java respectively.
The command I'm running to create the project is:
mvn archetype:generate -DgroupId=com.cs.test-project -DartifactId=test-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false The Reference to Command
And the VS Code Reference to Command
The same command is running in Command prompt and it created the project successfully on Desktop.
I fixed this problem by simply restarting VSCode as I had set my PATH variable while my VSCode was running so the changes were not reflected to the VSCode integrated terminal until I restarted it.
It's kindy counterintuitive as path has to be pointed to the actual mvn command, instead to a M2_PATH folder. Also once properly pointed, a new error will be shown if your environment is missing proper jdk within JAVA_HOME. The error is trown by maven. Maven plugin is kinda stupid as it will ignore your default JDK configured within settings.json (java.home or/and java.configuration.runtimes properties) and will happly NOT set java for maven. You have to configure it specificly for maven plugin as this:
"maven.executable.path": "c:\\apache-maven-3.8.1\\bin\\mvn",
"maven.terminal.customEnv": [{
"environmentVariable": "JAVA_HOME",
"value": "c:\\openjdk-1.8.0_232-redhat",
}]
Of course, both paths should be pointed to proper folders/files in your environment.
The way I fixed was by changing the exec path in Vs Code settings from CMD to Powershell.
Open
settings -> features -> terminal
Change the windows exec path from cmd to where you have PowerShell.
For example: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Windows exec setting
On Tuesday Oct. 25, 2022 while trying to solve the same problem, I went through all of these previous solutions for Windows and finally had to resort to the official installation docs:
Installing Apache Maven
Unzipped the download and located the bin directory and manually added that directory location to my: System Properties>Advanced>Environment Variables>'Path'
For good measure, restart the computer.

package org.junit does not exist

I am using Jenkins, and using a Github repo as Source Code.
In the Build section, I am executing this as a Windows Batch command:
set path=%path%;C:\Program Files\Java\jdk1.8.0_144\bin
cd \Users\harr\JenkinsServer\JenkinsTest\src
javac SimpleTest.java //Error is after this executes
java SimpleTest
I know it has something to do with classpath, but I am unsure how to solve this problem in jenkins.
Let me know if more information would be helpful.
Suppose you deploy the jekins server on linux platform, so you have to install the jdk, tomcat and so on, set the env path as well. Then you don't have to execute set path before every build.
you can create a script and copy the command into it, then when jenkins performs the build task, it can execute the script. Refer to the jenkins tutorial to learn about it.

install selenium via command or website?

I need help with knowing whether the best way to install selenium is via command line on Mac, or via the selenium website. Same for chrome or IE.exe, should that be installed via command line or the actual website?
If you recommend installing via the website how would that work out for running tests via CI (Jenkins) on other machines - we would practically need to install selenium/ or browser.exe on every machine right? Which is why I thought it may make more sense to install all this via command line.
Either way, any opinions would be greatly appreciated.
1) For run by Jenkins, the better way it's to setup a selenium grid follow guide: https://github.com/SeleniumHQ/selenium/wiki/Grid2
with seleniu grid, you not need to setup selenium on each jenkins salve. because
grid will supply browser machine for your test.
2) For run/debug on local, i recommend a way to setup selenium and chrome.exe/IE.exe by webdriver-manager, which is a Nodejs package.
so you need to install NodeJS firstly.
a. install nodejs:https://nodejs.org/en/download/package-manager/#macos
b. execute 'npm install -g webdriver-manager' in terminal
c. execute 'npm config get preifx', it will print out a path in terminal
d. export above path in PATH environment
e. execute 'webdriver-manager version' to check PATH evnrionment work as expect
3) the command to install selenium stuffs like:
webdriver-manager update --verions.standalone=3.4.0 --versions.chrome=2.30 --versions.ie=
or just webdriver-manager update , this will install latest version of selenium server jar and chromedriver.exe for chrome and geckodriver.exe for firefox.
A reminder: latest version may not compatible with your local browser. so I think you need use options: --versions.xxxx=xxxxx to install certain version.
if latest version not caompatible with your local browser, and you want to start a selenium server, you also need to append the versions options like used in update:
webdriver-manager start --versions.chome=xxxxx (if you need run with chrome)
--versions.gecko=xxxx (if run with firefox) --version.ie=xxxx (if run with ie)
all avaiable options you can get by execute webdriver-manager help as below:
webdriver-manager update --ie

Problems about Jenkins running remote shell script

I have some question when using jenkins.
the scenario:
I have installed a tomcat on machine A,and config all necessary environment including JDK, and they work well.
I wrote a shell script named restart.sh to kill the tomcat process,and restart.
I execute the script and it works well.When I check the tomcat process using ps -ef,and it shows the exact JDK path as I already config.The JDK path is /usr/local/java/JDK7
When I execute the restart.sh script via jenkins,problem comes. I can see the tomcat process using the wrong JDK path,/usr/bin/java,not the path as i config. I use SSH Publishers plugin to run the remote script.see as the image below:
enter image description here
I don't know how this problem happen,please help,Thanks all
This might be the problem of path variables, just to cross verify , find JAVA_HOME on your server 1. By logging onto server manually 2. From Exec command of your ssh section of your jenkins job , most probably you will find the answer.
i'm assuming you're jenkins is configured to use jdk which is defined at its root level.
if this didn't solve , we need to look into this problem from another angle.

Cannot get Maven working on Windows 7 [duplicate]

I just installed Maven and added the \bin directory of maven to my path variables. When I try to use the mvn command in the Command Prompt I just get a message:
mvn: command not found
Everything else I found on here did not help yet.
Edit:
I used https://maven.apache.org/install.html to install maven.
SET PATH=%PATH%;C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
You have included the file in the path:
C:\Program Files\Maven\apache-maven-3.5.0\bin\mvn.cmd
That is not good. The PATH environment variable should only include a path to where files, like exe and cmd's can be found.
Adapt your PATH to read like this:
C:\Program Files\Maven\apache-maven-3.5.0\bin
(so remove the \mvn.cmd). Make sure to start a new command prompt to verify if your path settings are correct.
See How can I set user environmental variables (such as PATH) from a non-administrator account on Windows 7 to find the correct Windows dialog to adapt the settings among many more.
Following this tutorial by mkyong, I was able to get this to work on Windows 10 (v10.0.15063):
Install JDK and setup JAVA_HOME system variable
Download Maven zip, extract it and setup M2_HOME and MAVEN_HOME system variables to point to root maven folder (without \bin)
Update PATH system variable to include %M2_HOME%\bin (this is what will let you run "mvn" in Command Prompt).
Open Command Prompt (cmd.exe) and execute mvn -version
You can download Maven (apache-maven-3.5.0-bin.zip) here, if you don't have it already.
The Java SDK (jdk-8u144-windows-x64.exe) can be downloaded from Oracle here.
This is my working maven configuration on Windows 10. Was more cumbersome to configure on W10 than on WXP or W7.
I've faced the same problem. I installed Maven and added the \bin directory of maven to my path variables in System Variables, so I can only use MAVEN commands using admin rights (run cmd in windows as administrator)
I solved this by creating all under User variables (including the PATH variable).

Categories

Resources