Pages

Sunday, 18 December 2011

Programatically Starting Selenium Server to accept SSL Certificates

  public static void startServerInProxymode(){
        // Precondition for the entire test class is Login
        ServerSocket serverSocket;
        try {
            serverSocket = new ServerSocket(RemoteControlConfiguration.DEFAULT_PORT);
            serverSocket.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            System.out.println("Failed to create socket connection on Default PORT");
            e.printStackTrace();
        }
       
        RemoteControlConfiguration rcc = new RemoteControlConfiguration();
        rcc.setTrustAllSSLCertificates(true);
        rcc.setPort(RemoteControlConfiguration.DEFAULT_PORT);
        try {
            server = new SeleniumServer(false,rcc);
            server.start();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
    }

No comments:

Post a Comment