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();
}
}
No comments:
Post a Comment