Total Articles 7,183
2011.11.03 03:33:33
1393
Start SeleniumServer on default port which is 4444:
import org.openqa.selenium.server.SeleniumServer;
public class Myclass {
public static SeleniumServer server;
public void startServer() {
server = new SeleniumServer();
// To start the SeleniumServer
server.start();
// To stop the SeleniumServer
server.stop();
}
}
Start SeleniumServer with specific configuration:
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
public class Myclass {
public static SeleniumServer server;
public static RemoteControlConfiguration rcc;
public void startServer(){
// Initializing RemoteControlConfiguration and setting to specific port and choosing to execute tests in SingleWindow mode
rcc = new RemoteControlConfiguation();
rcc.setPort(5555);
rcc.setSingleWindow(true);
// Starting SeleniumServer using the above defined rcc
server = new SeleniumServer(rcc);
public static RemoteControlConfiguration rcc;
public void startServer(){
// Initializing RemoteControlConfiguration and setting to specific port and choosing to execute tests in SingleWindow mode
rcc = new RemoteControlConfiguation();
rcc.setPort(5555);
rcc.setSingleWindow(true);
// Starting SeleniumServer using the above defined rcc
server = new SeleniumServer(rcc);
// To start the SeleniumServer
server.start();
// To stop the SeleniumServer
server.stop();
}}
Using
RemoteControlConfiguration, number of parameters can be set for the
SeleniumServer like enabling "browser side log" and using "proxy setting
mode" etc.
Start SeleniumServer with slowResource mode:
import org.openqa.selenium.server.SeleniumServer;
public class Myclass {
public static SeleniumServer server;
public void startServer(){
// The first parameter for the SeleniumServer Constructor is for slowResource mode. Hence making this to true will enable the slowResource mode.
server = new SeleniumServer(true);
public void startServer(){
// The first parameter for the SeleniumServer Constructor is for slowResource mode. Hence making this to true will enable the slowResource mode.
server = new SeleniumServer(true);
// To start the SeleniumServer
server.start();
// To stop the SeleniumServer
server.stop();
}In
slowResource mode the SeleniumServer will executes the commands slowly
on the browser, so that we can observe what commands are being executed
and where exactly the suite is failing.
Start SeleniumServer with slowResource mode & with RemoteControlConfiguration:
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
public class Myclass {
public static SeleniumServer server;
public static RemoteControlConfiguration rcc;
public void startServer(){
// Initializing RemoteControlConfiguration and setting to specific port and choosing to execute tests in SingleWindow mode
rcc = new RemoteControlConfiguation();
rcc.setPort(5555);
rcc.setSingleWindow(true);
// Starting SeleniumServer using the above defined rcc
server = new SeleniumServer(true, rcc);
public static RemoteControlConfiguration rcc;
public void startServer(){
// Initializing RemoteControlConfiguration and setting to specific port and choosing to execute tests in SingleWindow mode
rcc = new RemoteControlConfiguation();
rcc.setPort(5555);
rcc.setSingleWindow(true);
// Starting SeleniumServer using the above defined rcc
server = new SeleniumServer(true, rcc);
// To start the SeleniumServer
server.start();
// To stop the SeleniumServer
server.stop();
}
 
 




vivekjog
