Package com.thoughtworks.selenium

Examples of com.thoughtworks.selenium.DefaultSelenium


    selenium.stop();
  }

  protected static DefaultSelenium createSeleniumClient(String url)
      throws Exception {
    return new DefaultSelenium("localhost", 4444, "*firefox", url);
  }
View Full Code Here


    }

   
    @Override
    public void openBrowser(String browserName) {
        setSelenium(new DefaultSelenium(host, port, browserName, URL));
        this.start();
    }
View Full Code Here

        AbstractSeleniumTest.browser = browser;

        if ( getSelenium() == null )
        {
            DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
            s.start();
            s.setTimeout( maxWaitTimeInMs );
            selenium.set( s );
        }
    }
View Full Code Here

    {
        try
        {
            if ( getSelenium() == null )
            {
                selenium = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
                selenium.start();
                selenium.setTimeout( Integer.toString( maxWaitTimeInMs ) );
            }
        }
        catch ( Exception e )
View Full Code Here

        logger.info("setup: serverPort=" + serverPort);
        logger.info("setup: browser=" + browser);
        logger.info("setup: startUrl=" + startUrl);
        logger.info("setup: timeout=" + timeout);
        logger.info("setup: imagePath=" + imagePath);
        this.sel = new DefaultSelenium(serverHost, Integer.parseInt(serverPort), browser, startUrl);
        this.sel.start();
        this.sel.setTimeout(timeout);
    }
View Full Code Here

        if ( StringUtils.isEmpty( seleniumBrowser ) )
        {
            seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
        }

      final Selenium s = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl );
      selenium = new ThreadLocal<Selenium>()
      {
          protected Selenium initialValue()
          {
              return s;
View Full Code Here

        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);
                    }
View Full Code Here

   * Create a new default selenium, which is the selenium rc.
   * @param theServerUrl The url where to star selenium interaction.
   * @return Return a brand new default selenium.
   */
  private DefaultSelenium createSeleniumRc(final String theServerUrl) {
    DefaultSelenium newRC =  new DefaultSelenium(
        seleniumHost, seleniumPort, firefoxPath, theServerUrl);
    return newRC;
  }
View Full Code Here

   * @param orderNumber the order number for the expected email message.
   * @return the html source code for the email message.
   */
  public String getBuyerMessageMail(final String email, final String password,
      final String orderNumber) {
    DefaultSelenium gmailSeleniumRC = null;
    try {
      String gmailUrl = "http://gmail.google.com";
      gmailSeleniumRC = createSeleniumRc(gmailUrl);
      gmailSeleniumRC.start();
      gmailSeleniumRC.open(gmailUrl);
      gmailSeleniumRC.waitForPageToLoad("30000");

      //login
      gmailSeleniumRC.type("Email", email);
      gmailSeleniumRC.type("Passwd", password);
      gmailSeleniumRC.click("name=signIn");
      gmailSeleniumRC.waitForPageToLoad("30000");

      try {
        Thread.sleep(15000);
      } catch (InterruptedException e) {
        log.warn("Interrupted sleep", e);
      }

      gmailSeleniumRC.selectFrame("main");
      gmailSeleniumRC.selectFrame("v1");
      gmailSeleniumRC.waitForCondition(
          "selenium.browserbot.getCurrentWindow()"
          + ".document.getElementsByName('q')[0].value='" + orderNumber + "'",
      "1000");
      gmailSeleniumRC.submit("id=s");

      //open result if any
      try {
        Thread.sleep(5000);
      } catch (InterruptedException e) {
        log.warn("Interrupted sleep", e);
      }

      gmailSeleniumRC.keyPress("xpath=//body", "o");
      String result = gmailSeleniumRC.getHtmlSource();
      return result;
    } finally {
      if (gmailSeleniumRC != null) {
        gmailSeleniumRC.stop();
      }
    }
  }
View Full Code Here

      public void setUp(String url, String browserString, int port) {
          if (url == null) {
              url = "http://localhost:" + port;
          }
          selenium = new DefaultSelenium("localhost", port, browserString, url);
          selenium.start();
      }
View Full Code Here

TOP

Related Classes of com.thoughtworks.selenium.DefaultSelenium

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.