コード例 #1
0
        private void SetSelectedStandardsGroupList()
        {
            ChildSelectedStandardsGroupList = new List <SelectedStandardsGroupLineItem>();
            try
            {
                //try waiting to find the list of VISIBLE elements for a specified amount of time
                SelectedStandardsItems.WaitUntilVisible(5);
            }
            catch (Exception e)
            {
                //if the list of elements are not found, then they are INVISIBLE, so IGNORE them by nulling the list
                Report.Write("element was not found");
                ChildSelectedStandardsGroupList = null;
            }
            //if the list is not null, then the list of VISIBLE elements were found
            if (ChildSelectedStandardsGroupList != null)
            {
                //wait to find EXISTING elements (should only be VISIBLE, but checks for INVISIBLE) for a specified amount of time
                ChildSelectedStandardsGroupWebElementList = SelectedStandardsItems.WaitForElements(5);
                if (Driver.GetType() == typeof(DummyDriver))
                {
                    DummyWebElement dummy1 = new DummyWebElement();
                    dummy1.FakeAttributeId    = "17714";
                    dummy1.FakeAttributeDocid = "49";
                    dummy1.FakeAttributeNk    = "ACT-Alg1-D.1";
                    dummy1.FakeCssValueClass  = "ContractedNode";
                    DummyWebElement dummy2 = new DummyWebElement();
                    dummy2.FakeAttributeId    = "17715";
                    dummy2.FakeAttributeDocid = "49";
                    dummy2.FakeAttributeNk    = "ACT-Alg1-D.2";
                    dummy2.FakeCssValueClass  = "ContractedNode";
                    List <IWebElement> list = new List <IWebElement> {
                        dummy1, dummy2
                    };
                    ChildSelectedStandardsGroupWebElementList = new ReadOnlyCollection <IWebElement>(list);
                }

                foreach (var webElement in ChildSelectedStandardsGroupWebElementList)
                {
                    int standardId = int.Parse(webElement.GetAttribute("id"));
                    //string clazz = webElement.GetCssValue("class");
                    string clazz = webElement.GetAttribute("class");
                    int    standardDocumentId = int.Parse(webElement.GetAttribute("docid"));
                    string standardName       = webElement.GetAttribute("nk");
                    Report.Write("ChildStandardsLineItemList by standardId: '" + standardId + "'; class: '" + clazz + "'; standardDocumentId: '" + standardDocumentId + "'; standardName: '" + standardName + "'.");
                    var standardsLineItem = new SelectedStandardsGroupLineItem(webElement, PageNames, standardId, clazz, standardDocumentId, standardName);
                    ChildSelectedStandardsGroupList.Add(standardsLineItem);
                }
            }
        }
コード例 #2
0
        private void SetSelectedStandardsGroupList()
        {
            SelectedStandardsGroupList = new List <SelectedStandardsGroupLineItem>();
            //wait to find the VISIBLE element for a specified amount of time
            SelectedStandardsList.Wait(15);
            //wait to find the list of EXISTING elements (VISIBLE or INVISIBLE) for a specified amount of time
            SelectedStandardsGroupWebElementList = SelectedStandardsItems.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy0 = new DummyWebElement();
                dummy0.FakeAttributeValue = "49";
                dummy0.Text = "ACT Algebra 1";
                StandardDocument.FakeSelectedOption = dummy0;

                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeId    = "17687";
                dummy1.FakeAttributeDocid = "49";
                dummy1.FakeAttributeNk    = "ACT-Alg1-A";
                dummy1.FakeCssValueClass  = "ExpandedNode";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeId    = "17695";
                dummy2.FakeAttributeDocid = "49";
                dummy2.FakeAttributeNk    = "ACT-Alg1-B";
                dummy2.FakeCssValueClass  = "ExpandedNode";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeId    = "17705";
                dummy3.FakeAttributeDocid = "49";
                dummy3.FakeAttributeNk    = "ACT-Alg1-C";
                dummy3.FakeCssValueClass  = "ExpandedNode";
                DummyWebElement dummy4 = new DummyWebElement();
                dummy4.FakeAttributeId    = "17713";
                dummy4.FakeAttributeDocid = "49";
                dummy4.FakeAttributeNk    = "ACT-Alg1-D";
                dummy4.FakeCssValueClass  = "ContractedNode";
                DummyWebElement dummy5 = new DummyWebElement();
                dummy5.FakeAttributeId    = "17732";
                dummy5.FakeAttributeDocid = "49";
                dummy5.FakeAttributeNk    = "ACT-Alg1-E";
                dummy5.FakeCssValueClass  = "ContractedNode";
                DummyWebElement dummy6 = new DummyWebElement();
                dummy6.FakeAttributeId    = "17740";
                dummy6.FakeAttributeDocid = "49";
                dummy6.FakeAttributeNk    = "ACT-Alg1-F";
                dummy6.FakeCssValueClass  = "ContractedNode";
                DummyWebElement dummy7 = new DummyWebElement();
                dummy7.FakeAttributeId    = "17749";
                dummy7.FakeAttributeDocid = "49";
                dummy7.FakeAttributeNk    = "ACT-Alg1-G";
                dummy7.FakeCssValueClass  = "ContractedNode";
                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7
                };
                SelectedStandardsGroupWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            foreach (var webElement in SelectedStandardsGroupWebElementList)
            {
                int standardId = int.Parse(webElement.GetAttribute("id"));
                //string clazz = webElement.GetCssValue("class");
                string clazz = webElement.GetAttribute("class");
                int    standardDocumentId = int.Parse(webElement.GetAttribute("docid"));
                string standardName       = webElement.GetAttribute("nk");
                Report.Write("SelectedStandardsGroupLineItem by standardId: '" + standardId + "'; class: '" + clazz + "'; standardDocumentId: '" + standardDocumentId + "'; standardName: '" + standardName);
                var standardsLineItem = new SelectedStandardsGroupLineItem(webElement, PageNames, standardId, clazz, standardDocumentId, standardName);
                SelectedStandardsGroupList.Add(standardsLineItem);
            }
        }