Monday, September 10, 2012

How to setup the slow mode in Selenium RC using Java


How to setup the slow mode in Selenium RC using Java ?

I came across this issue several times when automating test scripts using Selenium RC & Java. In many instances you need to use the slow mode (especially when dealing with the dynamic components) in-order to run your script smoothly.

Following method can be used to set the selenium slow mode by pausing each and every step by limiting in to a specific time period (in milliseconds)


 //define a public string with the time limit you need to pause every step in milliseconds  
 public String timeout="6000";  
 //Add the initial steps to start selenium  
  RemoteControlConfiguration rc = new RemoteControlConfiguration();  
  seleniumserver = new SeleniumServer(rc);  
  selenium = new DefaultSelenium("localhost", 4444, browser, "http://");  
  seleniumserver.start();  
  selenium.start();  
 //Once the server is started then set the default timeout period ( in-order to emulate the slow mode )  
 selenium.setSpeed(timeout);  

No comments:

Post a Comment