Exemplo n.º 1
0
        //Mathematics grid to be implemented



        public void GetGridLocator()
        {
            By ByAllGrids = By.CssSelector("h4[class='section_title']");
            WebElementWrapper AllGrids = new WebElementWrapper(ByAllGrids);
            ReadOnlyCollection <IWebElement> gridList = AllGrids.FindElements();

            for (int i = 0; i < gridList.Count; i++)
            {
                if (gridList[i].Text.Contains(BenchmarkTestsTabAllTestsViewGridNames.ELA))
                {
                    _gridELAIndex   = i;
                    _gridELALocator = "#SubjectGroup" + Convert.ToString(_gridELAIndex);
                }
                //case "ELA":
                //    _gridELAIndex = i;
                //    _gridELALocator = "#SubjectGroup" + Convert.ToString(_gridELAIndex);
                //    break;
                //case "Computer and Information Sciences":
                //    _gridComputerScienceLocator = "#SubjectGroup" + Convert.ToString(i);
                //    break;
                //case "Mathematics":
                //    _gridMathematicsLocator = "#SubjectGroup" + Convert.ToString(i);
                //    break;

                //}
            }

            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                _gridELALocator             = "#SubjectGroup0";
                _gridComputerScienceLocator = "#SubjectGroup1";
                _gridMathematicsLocator     = "#SubjectGroup2";
            }
        }
Exemplo n.º 2
0
        private void NameKeywordPublisherLocator()
        {
            // the name, keyword and publisher fields sometimes exist and sometimes don't. when all
            // 3 exists, the id for each is as follows:
            // name: ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_rptTestItemProperties_ctl00_lblPropertiesValue
            // keyword: ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_rptTestItemProperties_ctl01_lblPropertiesValue
            // publisher: ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_rptTestItemProperties_ctl02_lblPropertiesValue
            //
            // if name or keyword doesn't exist, only publisher is there. control id for publisher become "ctl00"
            // publisher: ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_rptTestItemProperties_ctl00_lblPropertiesValue

            //span[id^='ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03'][id$='lblProperties']
            By ByPropLabels =
                By.CssSelector("span[id^='" + ControlPrefix + "ItemFinder1_ItemFinderResults1_gridResults_" +
                               UniqueId + "'][id$='lblProperties']");
            WebElementWrapper PropLabels = new WebElementWrapper(ByPropLabels);

            ReadOnlyCollection <IWebElement> allPropLabels = PropLabels.FindElements();
            int i = 0;

            foreach (var label in allPropLabels)
            {
                if (label.Text == "Name")
                {
                    NameCtl = "ctl0" + Convert.ToString(i);
                    i++;
                }
                if (label.Text == "Keyword")
                {
                    KeywordCtl = "ctl0" + Convert.ToString(i);
                    i++;
                }
                if (label.Text == "Publisher")
                {
                    PublisherCtl = "ctl0" + Convert.ToString(i);
                    i++;
                }
            }
        }