Package org.openqa.selenium.server

Examples of org.openqa.selenium.server.SeleniumServer$ShutDownHook


        if (args.length == 0) {
            throw new IllegalArgumentException("Please pass a directory argument on the command line");
        }
        File dir = new File(args[0]);
        dir.mkdirs();
        SeleniumServer server = new SeleniumServer();
        boolean result = false;
        try {
            server.start();
            result = new HTMLLauncher(server).runSelfTests(dir);
        } finally {
            server.stop();
        }
        return result ? 0 : 1;
    }
View Full Code Here


  @BeforeClass
  public void setup(String webappRoot) throws Exception
  {
    _jettyRunner = new JettyRunner("/", JETTY_PORT, webappRoot);

    _server = new SeleniumServer();

    _server.start();

    CommandProcessor cp = new HttpCommandProcessor("localhost", SeleniumServer.DEFAULT_PORT,
        "*firefox", BASE_URL);
View Full Code Here

  @BeforeClass
  public static void setUp() throws Exception {
    System.out.println("*** Starting selenium ... ***");
    RemoteControlConfiguration seleniumConfig = new RemoteControlConfiguration();
    seleniumConfig.setPort(4444);
    seleniumServer = new SeleniumServer(seleniumConfig);
    seleniumServer.start();

    String host = System.getProperty("myParam", "localhost");
    selenium = createSeleniumClient("http://" + host + ":" + "8080/client/");
    selenium.start();
View Full Code Here

   
    private static class ThreadLocalSelenium extends ThreadLocal {
        @Override
        public JtracSelenium initialValue() {
            try {
                server = new SeleniumServer();
                server.start();
            } catch(Exception e) {
                throw new RuntimeException(e);
            }
            JtracSelenium s = new JtracSelenium("localhost", SeleniumServer.getDefaultPort(), "*iexplore", "http://localhost:8080/jtrac");
View Full Code Here

                "  browserStart: " + browserStartCommand + sep +
                "       baseURL: " + baseURL);

        final Runnable stopWebServer = launchWebServer(container, webAppFolder, contextPath, port, sslPort);

        final SeleniumServer seleniumServer = new SeleniumServer();

        File ffProfileTemplate = new File(TapestryRunnerConstants.MODULE_BASE_DIR, "src/test/conf/ff_profile_template");

        if (ffProfileTemplate.isDirectory())
        {
            seleniumServer.getConfiguration().setFirefoxProfileTemplate(ffProfileTemplate);
        }

        seleniumServer.start();


        CommandProcessor httpCommandProcessor = new HttpCommandProcessor("localhost",
                seleniumServer.getPort(), browserStartCommand, baseURL);

        final ErrorReporterImpl errorReporter = new ErrorReporterImpl(httpCommandProcessor, testContext);

        ErrorReportingCommandProcessor commandProcessor = new ErrorReportingCommandProcessor(httpCommandProcessor,
                errorReporter);

        final Selenium selenium = new DefaultSelenium(commandProcessor);

        selenium.start();

        testContext.setAttribute(TapestryTestConstants.BASE_URL_ATTRIBUTE, baseURL);
        testContext.setAttribute(TapestryTestConstants.SELENIUM_ATTRIBUTE, selenium);
        testContext.setAttribute(TapestryTestConstants.ERROR_REPORTER_ATTRIBUTE, errorReporter);
        testContext.setAttribute(TapestryTestConstants.COMMAND_PROCESSOR_ATTRIBUTE, commandProcessor);

        testContext.setAttribute(TapestryTestConstants.SHUTDOWN_ATTRIBUTE, new Runnable()
        {
            public void run()
            {
                try
                {
                    LOGGER.info("Shutting down selenium client ...");

                    try
                    {
                        selenium.stop();
                    } catch (RuntimeException e)
                    {
                        LOGGER.error("Selenium client shutdown failure.", e);
                    }

                    LOGGER.info("Shutting down selenium server ...");

                    try
                    {
                        seleniumServer.stop();
                    } catch (RuntimeException e)
                    {
                        LOGGER.error("Selenium server shutdown failure.", e);
                    }
View Full Code Here

    log.trace("Entering init");

    int seleniumPort = parameters.getSeleniumServerPort();
    boolean startSeleniumServer = parameters.getStartSeleniumServer();
    if (startSeleniumServer) {
      SeleniumServer selenium = null;
      try {
        selenium = new SeleniumServer(seleniumPort, false, true);
        selenium.start();
      } catch (Exception e) {
        log.debug(e.getMessage());
        log.trace("Leaving init");
        throw new RuntimeException("Unable to start selenium sever.");
      }
View Full Code Here

        if (args.length == 0) {
            throw new IllegalArgumentException("Please pass a directory argument on the command line");
        }
        File dir = new File(args[0]);
        dir.mkdirs();
        SeleniumServer server = new SeleniumServer();
        boolean result = false;
        try {
            server.start();
            result = new HTMLLauncher(server).runSelfTests(dir);
        } finally {
            server.stop();
        }
        return result ? 0 : 1;
    }
View Full Code Here

            this.launchServer = launchServer;
        }
       
        public void setUp() throws Exception {
            if (launchServer) {
                server = new SeleniumServer();
                server.start();
            }
            try {
                sel = new DefaultSelenium("localhost", RemoteControlConfiguration.getDefaultPort(), browser,
                        startUrl);
View Full Code Here

        if(testParameters.containsKey(TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER))
            browserStartCommand = testParameters.get(TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER);
       
        stopWebServer = launchWebServer(webAppFolder, contextPath, port, sslPort);

        seleniumServer = new SeleniumServer();
       
        File ffProfileTemplate = new File(TapestryTestConstants.MODULE_BASE_DIR, "src/test/conf/ff_profile_template");
       
        if(ffProfileTemplate.isDirectory())
            seleniumServer.getConfiguration().setFirefoxProfileTemplate(ffProfileTemplate);
View Full Code Here

        String browserStartCommand = getParameter(xmlTest, TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER,
                "*firefox");

        final Runnable stopWebServer = launchWebServer(container, webAppFolder, contextPath, port, sslPort);

        final SeleniumServer seleniumServer = new SeleniumServer();

        File ffProfileTemplate = new File(TapestryTestConstants.MODULE_BASE_DIR, "src/test/conf/ff_profile_template");

        if (ffProfileTemplate.isDirectory())
            seleniumServer.getConfiguration().setFirefoxProfileTemplate(ffProfileTemplate);

        seleniumServer.start();

        String baseURL = String.format("http://localhost:%d%s/", port, contextPath);

        CommandProcessor httpCommandProcessor = new HttpCommandProcessor("localhost",
                RemoteControlConfiguration.DEFAULT_PORT, browserStartCommand, baseURL);

        ErrorReporter errorReporter = new ErrorReporterImpl(httpCommandProcessor, testContext);

        ErrorReportingCommandProcessor commandProcessor = new ErrorReportingCommandProcessor(httpCommandProcessor,
                errorReporter);

        final Selenium selenium = new DefaultSelenium(commandProcessor);

        selenium.start();

        testContext.setAttribute(TapestryTestConstants.BASE_URL_ATTRIBUTE, baseURL);
        testContext.setAttribute(TapestryTestConstants.SELENIUM_ATTRIBUTE, selenium);
        testContext.setAttribute(TapestryTestConstants.ERROR_REPORTER_ATTRIBUTE, errorReporter);
        testContext.setAttribute(TapestryTestConstants.COMMAND_PROCESSOR_ATTRIBUTE, commandProcessor);

        testContext.setAttribute(TapestryTestConstants.SHUTDOWN_ATTRIBUTE, new Runnable()
        {
            public void run()
            {
                try
                {
                    selenium.stop();
                    seleniumServer.stop();
                    stopWebServer.run();
                }
                finally
                {
                    testContext.removeAttribute(TapestryTestConstants.BASE_URL_ATTRIBUTE);
View Full Code Here

TOP

Related Classes of org.openqa.selenium.server.SeleniumServer$ShutDownHook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.