Is there any way to run selenium webdriver tests scripts from the command line that have been written using Java and JUnit through Eclipse IDE?
I've been trying to use Ant or Maven but I can't get it working.
Can someone please offer some advice about where to go with this?
The following steps will help you run selenium scripts from the command prompt without the help of eclipse.
Set the
CLASSPATH
for all the supporting files.Right-Click on MyComputer-->Proprties-->Advanced System Settings--> Click on "Advanced" tab in the new window-->Environment Variables--> SystemVariables--> Double click CLASSPATH variable
In the window that gets opened, there is a variable field, where you need to set the path as described below. For this you need to have Admin rights on your system.
My environment variables look like this.
Save and exit.
Open command prompt and navigate to the folder where your selenium script is located.
Make sure you remove the package statements in your script.
Then compile the script using
javac programName.java
command.If it does not throw any errors, proceed with execution type
java programName
and hit Enter.If everything is set up fine till now, the selenium script should start executing the actions by invoking the browser mentioned in the script.