java client driver

3 views
Skip to first unread message

rahul

unread,
Feb 24, 2009, 1:10:04 AM2/24/09
to selenium-users...@googlegroups.com
Hi

how to configure java clinet driver in selenium and execute java code.

Simon Stewart

unread,
Feb 24, 2009, 3:26:17 AM2/24/09
to selenium-users...@googlegroups.com
This page may provide some useful information for you (including an example):

http://seleniumhq.org/documentation/remote-control/languages/java.html

The basic steps you need to do are:

1) Start the selenium rc server on the command line:

java -jar selenium-server.jar

(this should start the server listening on port 4444)

2) In your Java code, create a new instance of Selenium:

Selenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",
"http://your_test_server/");
selenium.start();

That final argument is the "baseUrl", from which all relative URLs are derived.

3) Don't forget to call "selenium.stop()" when you're done with the
particular browser.

Simon

rahul

unread,
Feb 24, 2009, 4:11:41 AM2/24/09
to selenium-users...@googlegroups.com
Hi Simon

how to install junit i am getting error
ava org.junit.tests.runner.JUnitCore org.junit.tests.AllTests\\ ption in thread "main" java.lang.NoClassDefFoundError: org/junit/tes\\ nitCore\\ ed by: java.lang.ClassNotFoundException: org.junit.tests.runner.JUni\\     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)\\     at java.security.AccessController.doPrivileged(Native Method)\\     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)\\     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)\\     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)\\     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)\\     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)\\ while installing junit.

tobaius

unread,
Feb 24, 2009, 8:21:14 AM2/24/09
to selenium-users...@googlegroups.com
You have to add the junit library to your project, if you are using the eclipse you will have to configure the build path of your java project.

rahul

unread,
Feb 24, 2009, 8:38:56 AM2/24/09
to selenium-users...@googlegroups.com
Hi [/people/tobaius]

do you knnow the steps add add the junit library to your project through eclipse.

tobaius

unread,
Feb 24, 2009, 9:09:42 AM2/24/09
to selenium-users...@googlegroups.com
Yes here it is :
## Right click on your java project - > *Build Path* - > *Configure Build Path*
## Then click on the button *"Add External Jars"*.
## Specify the path to your junit.jar on your local drive. Click Open.
## Click OK.
That's all.

rahul

unread,
Feb 25, 2009, 12:46:30 AM2/25/09
to selenium-users...@googlegroups.com
Hi [/people/tobaius]

Do you know configuration through Junit.

Rahul

tobaius

unread,
Feb 25, 2009, 2:50:38 AM2/25/09
to selenium-users...@googlegroups.com
There is a simple tutorial right here [http://seleniumhq.org/documentation/remote-control/languages/selenium-java-example-for-newbies.zip], this example contains a simple test in a java using JUnit.

Reply all
Reply to author
Forward
0 new messages