Package com.thoughtworks.selenium

Examples of com.thoughtworks.selenium.Selenium

  • link=textPattern: Select the link (anchor) element which contains text matching the specified pattern.
  • css=cssSelectorSyntax: Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.

    Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).

  • Without an explicit locator prefix, Selenium uses the following default strategies:

    Element Filters

    Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.

    Filters look much like locators, ie.

    filterType=argument

    Supported element-filters are:

    value=valuePattern

    Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.

    index=index

    Selects a single element based on its position in the list (offset from zero).

    String-match Patterns

    Various Pattern syntaxes are available for matching string values:

    If no pattern prefix is specified, Selenium assumes that it's a "glob" pattern.

    For commands that return multiple values (such as verifySelectOptions), the string being matched is a comma-separated list of the return values, where both commas and backslashes in the values are backslash-escaped. When providing a pattern, the optional matching syntax (i.e. glob, regexp, etc.) is specified once, as usual, at the beginning of the pattern.


     
      /**
       * Returns the current browser.
       */
      public static final Selenium getCurrent() {
          Selenium selenium = _selenium.get();
          if (selenium == null)
              Thread.dumpStack();
         
          return selenium;
      }
    View Full Code Here


        getCurrent().windowMaximize();
      }

      @Override
      public void stop() {
        Selenium selenium = getCurrent();
        selenium.close();
        selenium.stop();
        _selenium.remove()
      }
    View Full Code Here

        key = key.toLowerCase();
        String browserBand = getBrowserBand(key, isSecured);
        if (browserBand == null)
          throw new NullPointerException("Null Browser Type String");

        Selenium browser = _browserHolder.get(key);
        if (browser == null) {
          // @Todo add multiple client support
          String browserpath = _browserPathMap.containsKey(key) ? _browserPathMap.get(key):"";
          browserpath = ("".equals(browserpath) ? "" : " " + browserpath);
         
          if (_browserClient.containsKey(key)) {
            browser = new ZKSelenium(new HttpCommandProcessor(_browserClient.get(key) + "/selenium-server/driver/",
                browserBand + browserpath, _server), browserpath, browserBand,key,_openonce);
          } else {
            browser = new ZKSelenium(new HttpCommandProcessor(_client + "/selenium-server/driver/", browserBand + browserpath,
                _server), browserpath , browserBand,key,_openonce);
          }
          System.out.println("connecting "+key);
          browser.setSpeed(getDelay());
          _browserHolder.put(key, browser);
        }
        return browser;
      }
    View Full Code Here

     
      /**
       * Returns the current browser.
       */
      public static final Selenium getCurrent() {
          Selenium selenium = _selenium.get();
          if (selenium == null)
              Thread.dumpStack();
         
          return selenium;
      }
    View Full Code Here

        getCurrent().windowMaximize();
      }

      @Override
      public void stop() {
        Selenium selenium = getCurrent();
        selenium.close();
        selenium.stop();
        _selenium.remove()
      }
    View Full Code Here

        key = key.toLowerCase();
        String browserBand = getBrowserBand(key, isSecured);
        if (browserBand == null)
          throw new NullPointerException("Null Browser Type String");

        Selenium browser = _browserHolder.get(key);
        if (browser == null) {
          // @Todo add multiple client support
          String browserpath = _browserPathMap.containsKey(key) ? _browserPathMap.get(key):"";
          browserpath = ("".equals(browserpath) ? "" : " " + browserpath);
         
          if (_browserClient.containsKey(key)) {
            browser = new ZKSelenium(new HttpCommandProcessor(_browserClient.get(key) + "/selenium-server/driver/",
                browserBand + browserpath, _server), browserpath, browserBand,key,_openonce);
          } else {
            browser = new ZKSelenium(new HttpCommandProcessor(_client + "/selenium-server/driver/", browserBand + browserpath,
                _server), browserpath , browserBand,key,_openonce);
          }
          System.out.println("connecting "+key);
          browser.setSpeed(getDelay());
          _browserHolder.put(key, browser);
        }
        return browser;
      }
    View Full Code Here

     
      /**
       * Returns the current browser.
       */
      public static final Selenium getCurrent() {
          Selenium selenium = _selenium.get();
          if (selenium == null)
              Thread.dumpStack();
         
          return selenium;
      }
    View Full Code Here

        getCurrent().windowMaximize();
      }

      @Override
      public void stop() {
        Selenium selenium = getCurrent();
        selenium.close();
        selenium.stop();
        _selenium.remove()
      }
    View Full Code Here

      private Selenium getBrowserFromHolder(String key) {
        key = key.toLowerCase();
        if (_browserNameMap.get(key) == null)
          throw new NullPointerException("Null Browser Type String");

        Selenium browser = _browserHolder.get(key);
        if (browser == null) {
          // @Todo add multiple client support
          String browserpath = _browserPathMap.containsKey(key) ? _browserPathMap.get(key):"";
          browserpath = ("".equals(browserpath) ? "" : " " + browserpath);
         
          String browserBand = getBrowserBand(key) ;
          if (_browserClient.containsKey(key)) {
            browser = new ZKSelenium(new HttpCommandProcessor(_browserClient.get(key) + "/selenium-server/driver/",
                browserBand + browserpath, _server), browserpath, browserBand,key,_openonce);
          } else {
            browser = new ZKSelenium(new HttpCommandProcessor(_client + "/selenium-server/driver/", browserBand + browserpath,
                _server), browserpath , browserBand,key,_openonce);
          }
          System.out.println("connecting "+key);
          browser.setSpeed(getDelay());
          _browserHolder.put(key, browser);
        }
        return browser;
      }
    View Full Code Here

            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
                    {
    View Full Code Here

    TOP

    Related Classes of com.thoughtworks.selenium.Selenium

    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.