Package org.openqa.selenium.server

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


   {
      RemoteControlConfiguration rcc = new RemoteControlConfiguration();
      rcc.setPort(SELENIUM_SERVER_PORT);
      rcc.setLogOutFileName(OUTPUT_DIR + "/selenium-server.log");
      setSeleniumServerProperties(rcc);
      seleniumServer = new SeleniumServer(rcc);
      seleniumServer.start();
   }
View Full Code Here


    @Test
    public void serverCreatedAndDestroyed() throws Exception {

        fire(new SeleniumServerConfigured(configuration));

        SeleniumServer server = getManager().getContext(SuiteContext.class).getObjectStore().get(SeleniumServer.class);

        Assert.assertNotNull("Selenium configuration object is present in context", server);
        assertEventFired(SeleniumServerStarted.class, 1);

        fire(new AfterSuite());
View Full Code Here

    @Test
    public void userExtensionsLoaded() throws Exception {

        fire(new SeleniumServerConfigured(configuration));

        SeleniumServer server = getManager().getContext(SuiteContext.class).getObjectStore().get(SeleniumServer.class);

        Assert.assertNotNull("Selenium configuration object is present in context", server);
        Assert.assertNotNull("Selenium Server configuration is present", server.getConfiguration());
        Assert.assertNotNull("Selenium Server user extensions were set", server.getConfiguration().getUserExtensions());
        InputStream is = null;
        try {
            is = server.getResourceAsStream("simple-extension.js");
        } catch (IOException e) {
            Assert.fail("simple-extension.js was loaded.");
        }
        String simpleExtension = IOUtil.asUTF8String(is);
        Assert.assertTrue("simple-extension.js contains doTypeRepeated(locator,text) function",
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);

        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
                {
                    selenium.stop();
                    seleniumServer.stop();
                    stopWebServer.run();

                    // Output, at the end of the Test, any html capture or screen shots (this makes it much easier
                    // to locate them at the end of the run; there's such a variance on where they end up based
                    // on whether the tests are running from inside an IDE or via one of the command line
View Full Code Here

    public void setup(ITestContext testContext) throws Exception
    {
        jettyRunner = new JettyRunner(TapestryTestConstants.MODULE_BASE_DIR, "/", JETTY_PORT,
                webappRoot, virtualHosts);

        server = new SeleniumServer();

        server.start();

        CommandProcessor cp = new HttpCommandProcessor("localhost",
                RemoteControlConfiguration.DEFAULT_PORT, seleniumBrowserCommand, BASE_URL);
View Full Code Here

        createJettySessionsTable();

        serverA = configureClusteredJetty(SERVER_A_NAME, SERVER_A_PORT);
        serverB = configureClusteredJetty(SERVER_B_NAME, SERVER_B_PORT);

        seleniumServer = new SeleniumServer();
        seleniumServer.start();

        String browserStartCommand = xmlTest.getParameter(TapestryTestConstants.BROWSER_START_COMMAND_PARAMETER);
        browserStartCommand = browserStartCommand != null ? browserStartCommand : FIREFOX_BROWSER_CMD;
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);

        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
                {
                    selenium.stop();
                    seleniumServer.stop();
                    stopWebServer.run();

                    // Output, at the end of the Test, any html capture or screen shots (this makes it much easier
                    // to locate them at the end of the run; there's such a variance on where they end up based
                    // on whether the tests are running from inside an IDE or via one of the command line
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()
        {
            @Override
            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

        configureLogging();
        RemoteControlConfiguration configuration = new RemoteControlConfiguration();
        configuration.setTimeoutInSeconds(timeoutInSeconds);
        configuration.setProxyInjectionModeArg(true);
       
        server = new SeleniumServer(false, configuration);
        server.start();
        BrowserLauncherFactory.addBrowserLauncher("dummy", DummyBrowserLauncher.class);
        InjectionHelper.setFailOnError(false);
        LOGGER.info("Starting " + getName());
    }
View Full Code Here

    @BeforeClass(alwaysRun = true)
    public void setup() throws Exception
    {
        jettyRunner = new JettyRunner(TapestryTestConstants.MODULE_BASE_DIR, "/", JETTY_PORT, webappRoot);

        server = new SeleniumServer();

        server.start();

        CommandProcessor cp = new HttpCommandProcessor("localhost", SeleniumServer.DEFAULT_PORT,
                                                       seleniumBrowserCommand, BASE_URL);
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.