Procedure:
=========
- Create a bat file as mentioned below and place it inside the project folder
- Create a java class as mentioned below and invoke the windows command prompt and call the above created bat
- Now you can continue to start your selenium test case execution
===============
Creating a .bat file:
==============
- Open a notepad or any editor and Type the following without double qoutes "java -jar selenium-server-standalone-2.0b2.jar -interactive -port 4444". Note, the selenium-server-standalone-2.0b2.jar file should be in the same folder as of the bat file or else it will not work. If the server and bat file are place in different location, then proper path should be mentioned in the bat file.
- Save the file as sel-start.bat
Creating a java class file to call he above created .bat file:
========================================
package com
import org.apache.log4j.Logger;
/**
* @author : ramesh
* @purpose : This class will start the Selenium Server automatically.
* @usage : Instantiate this class to start the Selenium Server
*
*/
public class StartSeleniumServer
{
Logger log = Logger.getLogger(StartSeleniumServer.class);
public void startServer() throws Exception
{
Runtime run =Runtime.getRuntime();
try
{
run.exec("cmd.exe /c start sel-start.bat");
Thread.sleep(5000);
log.info("Started the Selenium Server successfully");
}
catch (Exception e)
{
log.error("Could not start the Server Server Due to the following reason.",e);
}
}
}
Yuppie, now you are set to go.
Nice blog post on Testing
ReplyDeleteQTP Training in Chennai | Selenium Training in Chennai