Doing driven mode Selenium test with Java

Download Selenium Remote Control, unpack it.

Inside there is a Selenium server, and many client driver for different language.

Start the server by running java -jar selenium-server.jar. The default port is 4444.

Then open a java project in netbeans, include the client driver for java in your project, selenium-java-client-driver.jar .

Create DefaultSelenium object, this object will communicate with the server to run tests and do different tasks.

The constructor of DefaultSelenium need four parameters: hostname, port, browser string, url.

Browser string define what browser you use, please reference to the javadoc.

Here is a sample: new DefaultSelenium("localhost",4444,"*iexplore","");

Run start() method to begin, stop() to close browser.

You may then integrate it with JUnit or TestNG to do data-driven tests.

According to their tutorial, TestNG should be easier.