Ejemplo n.º 1
0
        /// <summary>
        /// Use this to select a menu option from a field like a drop down.  See Selenium for advanced tips
        /// </summary>
        /// <param name="fieldID">The web element</param>
        /// <param name="option">The menu option</param>
        public void Select(string fieldID, string option)
        {
            counter++;

            try
            {
                if (IsElementPresent(fieldID))
                {
                    if (ElementVisible(fieldID))
                    {
                        selenium.Select(fieldID, option);
                        test.passedcheck++;
                    }
                    else
                    {
                        ErrorReport(fieldID, CheckType.Element);
                        test.failedcheck++;
                    }
                }
                else
                {
                    ErrorReport(fieldID, CheckType.Element);
                    test.failedcheck++;
                }
            }
            catch// (Exception)
            {
                ErrorReport(fieldID, CheckType.Element);
                test.failedcheck++;
            }
        }
Ejemplo n.º 2
0
        /**
         * Browse to a random category on the top menu.
         *
         * public void browseToRandomCategoryOnTopMenu() {
         *      Random random = new Random();
         *
         *      String[] exclusions = properties.getPropertyAsArray("test.category.configurable", ",");
         *      Number numCat = browser.getXpathCount("//div[@id='tabs10']/ul/li");
         *
         *      int rInt = random.nextInt(numCat) + 1;
         *      String cat = browser.getText("//div[@id='tabs10']/ul/li[${rInt}]/a/span");
         *
         *      // Repick a category if category exists in exclusion list
         *      while(exclusions.any { cat == it.toString() }) {
         *              rInt = (rInt-1) % numCat;
         *              cat = browser.getText("//div[@id='tabs10']/ul/li[${rInt}]/a/span");
         *      }
         *
         *      browser.clickAndWait("//div[@id='tabs10']/ul/li[${rInt}]/a/span");
         * }
         **/

        /**
         * Do a product search with given search term and category filter.
         **/
        public void doAProductSearchWithCategory(string term, string category)
        {
            //This may need further identification
            driver.Select("//div[@id='search']//select[@name='categoryId']", category);
            doAProductSearch(term);
        }