Running Webdriver scripts from command line

4,039 views
Skip to first unread message

Aparna

unread,
Dec 7, 2011, 5:11:58 AM12/7/11
to Selenium Users
Hello All,

Does anyone know how to run Webdriver scripts from command line? I
have written my tests in Eclipse. Now I have to make the run everyday
basis automatically,

Please guide me.

Thanks,
Aparna

bruce

unread,
Dec 7, 2011, 5:41:42 PM12/7/11
to seleniu...@googlegroups.com
hey...

what language are you using? I'm assuming you're using the Eclipse IDE, but what programming language?


Aparna

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Mike Riley

unread,
Dec 8, 2011, 1:32:51 AM12/8/11
to seleniu...@googlegroups.com
I think I posted on this before, but I should probably add it to my blog so I can just point to
it. Before you get an answer though what version of Selenium, what language, and what testing
framework are you using?

There is a way to start TestNG from your Java code, or you can use Ant or some other method to
start it, as I know a lot of people here do. Personally, I have my program code manage it all,
so it works the same in the IDE and at the command line. Google for starting TestNG
programmatically and you will find it.

So all I do is (from the correct directory):
java -jar program.jar <command options>

For running them every day it would help to know what OS you are using. On Windows I use Task
Manager, but on Linux or some other *nix platform you would use cron. In either case the job
would run a script/batch file to run your test program, changing to the right directory, using
any command line options, etc.

I hope that helps you.

Mike

Krishnan Mahadevan

unread,
Dec 8, 2011, 9:34:39 AM12/8/11
to seleniu...@googlegroups.com
The other alternative for kicking off tests automatically on a schedule would be to setup a hudson/jenkins server , create jobs on it which can be configured to kick off 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.

Manoj Pahuja

unread,
Dec 15, 2011, 5:10:05 PM12/15/11
to Selenium Users
Hi Krishnan,

Can you please provide information on how to create a job which would
run in a bamboo environment? The tests are written in Java using the
selenium-standaloneserver jar file as a dependency on a windows
platform using eclipse.

Thanks
Manoj

On Dec 8, 6:34 am, Krishnan Mahadevan


<krishnan.mahadevan1...@gmail.com> wrote:
> The other alternative for kicking off tests automatically on a schedule
> would be to setup a hudson/jenkins server , create jobs on it which can be
> configured to kick off
>
> Thanks & Regards
> Krishnan Mahadevan
>
> "All the desirable things in life are either illegal, expensive, fattening
> or in love with someone else!"
>

> > To post to this group, send email to selenium-users@googlegroups.**com<seleniu...@googlegroups.com>
> > .
> > To unsubscribe from this group, send email to selenium-users+unsubscribe@*
> > *googlegroups.com <selenium-users%2Bunsu...@googlegroups.com>.
> > For more options, visit this group athttp://groups.google.com/**
> > group/selenium-users?hl=en<http://groups.google.com/group/selenium-users?hl=en>
> > .

Krishnan Mahadevan

unread,
Dec 16, 2011, 2:31:25 AM12/16/11
to seleniu...@googlegroups.com
Manoj,
I have only used Hudson and am not familiar with Bamboo...

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"


To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Krishnan Mahadevan

unread,
Oct 5, 2012, 2:48:34 AM10/5/12
to seleniu...@googlegroups.com
This doesnt have anything to do with Selenium.

Have you tried googling on this ? There are a lot of tutorials that teach you how to do this for both JUnit and TestNG.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Fri, Oct 5, 2012 at 12:16 PM, pritz <pritupa...@gmail.com> wrote:
I want to run the Webdriver scripts through cmd prompt.My scripts are written in java n
is executed by Junit and TestNg both.Kindly,provide the solution.

Can u plz specify step by step like what is the command option and stuffs.

Thanks Pritz.
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Y3Sl0kgswmwJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mark Collin

unread,
Oct 10, 2012, 5:29:17 PM10/10/12
to seleniu...@googlegroups.com
Sounds like a class path problem.

Ramesh Yatam

unread,
Apr 14, 2013, 9:13:07 AM4/14/13
to seleniu...@googlegroups.com
can any one give steps to run the webdiver scripts through command prompt.

i have created batch file.xml file, i want to run throught command prompt.

I want the commands please

Thanks,
Ramesh

Krishnan Mahadevan

unread,
Apr 14, 2013, 9:38:32 AM4/14/13
to seleniu...@googlegroups.com
Ramesh,
You would need to tell us what is your client bindings flavor [.NET, Java, python ]


But i would suggest that you search for running java/.NET/python code from command line. That should help get answers for your question. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/Evha97uDYksJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Ripon Al Wasim

unread,
Apr 15, 2013, 12:46:48 AM4/15/13
to seleniu...@googlegroups.com
If u use Java you can use Ant for running test suite.

br,
Ripon

Ramesh Yatam

unread,
Apr 15, 2013, 12:52:39 AM4/15/13
to seleniu...@googlegroups.com
Hi Krishnan,
 
thanks for reply,
 
Iam using Java, selenium webdrivers, i have a suite and want to run from command prompt. i have created xml for the testsuite.
 
so how to run the xml from command promt or i see some comments like
 
java -jar selenium-stand... <testcases.html> <testresult.html>
 
Can you tell how to create our webdriver test cases into html file and run through command prompt



--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/Ohq6ORcVm2A/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Krishnan Mahadevan

unread,
Apr 15, 2013, 3:41:20 AM4/15/13
to Selenium Users
Ramesh,
The html option was built for Selenium IDE tests and NOT for WebDriver tests.
For WebDriver tests I would suggest that you please convert them into either JUnit tests or TestNG tests. 
Once you have done that, you can make use of either Ant or Maven to kick them off from commandline.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


Ramesh Yatam

unread,
Apr 15, 2013, 5:38:47 AM4/15/13
to seleniu...@googlegroups.com
ok, i am using testng test only, i install the ant also, can you tell me the steps, below are the details

package : jobserve
Classes : login, homepage, searchingjob.

I want to run all the classes from the command prompt can you send the steps.

Ripon Al Wasim

unread,
Apr 15, 2013, 5:47:28 AM4/15/13
to seleniu...@googlegroups.com
Write testng.xml enlisting all classes on <classes> tag. Then write build.xml and include testng.xml file on build.xml file.

br,
ripon

Krishnan Mahadevan

unread,
Apr 15, 2013, 6:31:44 AM4/15/13
to Selenium Users

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


Ramesh Yatam

unread,
Apr 15, 2013, 7:16:02 AM4/15/13
to seleniu...@googlegroups.com
Thanks so much,

Yes i have the same, like prepared xml, like below, but iam getting error when iam running it, command used

start ant -f xxxxx.xml

i have made above statement as bat file and executed then it is thorwing error like unrecognised <Suite>

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


<?xml
version="1.0" encoding="UTF-8"?>
<!-- Filename: testng.xml Note: You have to change the following according to your environment: -<class name="com.packageName.MyTestClassName" /> --> <!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" > <suite name="My Test Suite">   <test name="My Test">   <!-- Add all classes you would like TestNG to run. --> <classes> <class name="com.packageName.MyTestClassName" /> </classes>   </test>   </suite>

Satya Goyal

unread,
Apr 15, 2013, 10:29:36 AM4/15/13
to seleniu...@googlegroups.com
Please paste it in your xml file and try it 


<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My Test Suite">
<test name="My Test">
    <classes>
        <class name="com.packageName.MyTestClassName" ></class>  
    </classes>
</test>
</suite>
Thanks and Regards,
/Satya

Amal Kar

unread,
Oct 21, 2013, 10:33:32 AM10/21/13
to seleniu...@googlegroups.com


Hello All,

Does anyone know how to run android webdriver scripts from command line? I do not use junit/testNG framework code in my code. I just want to get the out put thru command line. Can anyone help me in this?

Please guide me.

Thanks,
Amal

Amal Kar

unread,
Oct 25, 2013, 2:57:09 AM10/25/13
to seleniu...@googlegroups.com, lvsk...@cox.net
Hi Mike,

I need help, very urgent, pls help.

I could able to run android web driver test cases using eclipse, but while used same script to run standalone it gives me following error.

Pls help.

java -cp "selenium-server-standalone-2.33.0.jar" HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: HelloWorld.  Program will exit.
Reply all
Reply to author
Forward
0 new messages