Run Selenium Server using Java code
Working with Selenium Server API.
While working with selenium server first we
need to setup configuration of selenium server, like on which port the server
will run, Avoid proxy setting, start logs etc.
For working with Selenium server configuration, we need to
perform following tasks.
1à Add selenium server jar file in build path of
current project.
2à Import org.openqa.selenium.sever.RemoteControlConfiguration;
Here we have imported selenium sever Rcmote Control
Configuration Class, we can need to create object of that class and then we can
use methods of the class to ser remote control server configuration.
3à Create RemoteControlConfiguration object
RemoteControlConfiguration rc = new RemoteControlConfiguration();
4à Set Port
rc.setPort(4444);
5à Set Proxy
rc.setAvoidProxy(true)
6à Set Browser side logs
rc.setBrowserSideLogsEnabled(true)
By this way we can set as much settings as we want in
RemoteControlConfiguration
RemoteControlConfiguration
rc = new RemoteControlConfiguration();
rc.setPort(4444);
rc.setAvoidProxy(true);
rc.setBrowserSideLogEnabled(true);
////////////////////////////// CODE
/////////////////////////////////
package
org.selenium.server;
import
org.openqa.selenium.server.RemoteControlConfiguration;
public class SeleniumServer{
public void startServer()
{
try
{
RemoteControlConfiguration rc = new
RemoteControlConfiguration();
rc.setPort(4444);
rc.setAvoidProxy(true);
rc.setBrowserSideLogEnabled(true);
}
catch(Exception ex){}
}
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment