Esempio n. 1
0
  /**
   * Method to start selenium server
   *
   * @author Gaurav Bansal
   */
  public void startSeleniumServer() {
    logger.info("Starting Selenium Server.........This might take around 10-15 seconds.");
    RemoteControlConfiguration rcc = new RemoteControlConfiguration();
    rcc.setPort(4444);
    rcc.setTimeoutInSeconds(600);
    rcc.setSingleWindow(false);

    rcc.setFirefoxProfileTemplate(
        new File(ConfigFileReader.getConfigItemValue("selenium.firefox.profile")));
    // rcc.setAvoidProxy(true);
    rcc.setTrustAllSSLCertificates(true);

    try {
      server = new SeleniumServer(false, rcc);
      server.boot();

    } catch (Exception e) {
      logger.info(e.getMessage());
      logger.info("Server is already running so reusing that.....");
    }
  }
  @BeforeSuite(alwaysRun = true)
  public void setupBeforeSuite(ITestContext context) {
    String seleniumHost = "localhost";
    String seleniumPort = "9080";
    String seleniumBrowser = "firefox";
    String seleniumUrl = "http://localhost:8080/molgenis_apps/";

    RemoteControlConfiguration rcc = new RemoteControlConfiguration();
    rcc.setSingleWindow(true);
    rcc.setPort(Integer.parseInt(seleniumPort));

    try {
      server = new SeleniumServer(false, rcc);
      server.boot();
    } catch (Exception e) {
      throw new IllegalStateException("Can't start selenium server", e);
    }

    proc =
        new HttpCommandProcessor(
            seleniumHost, Integer.parseInt(seleniumPort), seleniumBrowser, seleniumUrl);
    selenium = new DefaultSelenium(proc);
    selenium.start();
  }