Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Monday, February 28, 2011

How to configure/change running other than on default port

Pogrammatically changing the default port.

RemoteControlConfiguration class which is contained in selenium-server.jar:

import org.openqa.selenium.server.RemoteControlConfiguration;

@Test

public void remoteControlConfigExample()
{
final int SELENIUM_PORT = 8888;
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(SELENIUM_PORT);
SeleniumServer seleniumServer=null;
try
{
seleniumServer = new SeleniumServer(rcConfig);
seleniumServer.start();
} catch (Exception e)
{
e.printStackTrace();
}
Selenium selenium=null;
selenium = new DefaultSelenium("localhost", SELENIUM_PORT, "*firefox","http://www.google.com");
selenium.start();
//Add your piece of actions here & then followed by
selenium.close();
selenium.stop();
if(seleniumServer!=null)
{
seleniumServer.stop();
}
} automationwithselenium.blogspot.com-Google pagerank and Worth

No comments:

Post a Comment