Ejemplo n.º 1
0
        private void SetAttachRubricResultList()
        {
            WaitForIFrameToDisplay();

            AttachRubricResultsList = new List <AttachRubricLineItem>();
            SearchResultsGrid.Wait(3);
            AttachRubricResultsWebElementList = SearchResultsRows.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeId  = "ctl00_MainContent_GridRubrics_ctl03_AddButton";
                dummy1.FakeAttributeRid = "8789";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeId  = "ctl00_MainContent_GridRubrics_ctl04_AddButton";
                dummy2.FakeAttributeRid = "8790";

                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2
                };
                AttachRubricResultsWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            int index = 0;

            foreach (var webElement in AttachRubricResultsWebElementList)
            {
                int    itemid         = -1;
                string attachButtonId = null;
                string uniqueId       = null;

                itemid         = int.Parse(webElement.GetAttribute("rid"));
                attachButtonId = webElement.GetAttribute("id");
                Report.Write("Got the attribute: 'id' = '" + attachButtonId + "' of attach button [" + index + "].");
                uniqueId = GetUniqueId(attachButtonId);

                Report.Write("AttachRubricLineItem by itemid: '" + itemid + "'; index: '" + index + "'; uniqueId: '" + uniqueId);
                var lineItem = new AttachRubricLineItem(itemid, index, uniqueId, this.Parent.CurrentWindowHandle);
                AttachRubricResultsList.Add(lineItem);
                index++;
            }
        }
Ejemplo n.º 2
0
        private void SetItemCentralResultList()
        {
            ItemCentralResultsList = new List <ItemCentralLineItem>();
            SearchResultsGrid.Wait(3);
            ItemCentralResultsWebElementList = SearchResultsRows.WaitForElements(5);
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeItemid    = "231270";
                dummy1.FakeAttributePassageid = "35605";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeItemid    = "231271";
                dummy2.FakeAttributePassageid = "35606";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeItemid    = "231272";
                dummy3.FakeAttributePassageid = "35607";
                DummyWebElement dummy4 = new DummyWebElement();
                dummy4.FakeAttributeItemid    = "231273";
                dummy4.FakeAttributePassageid = "35608";
                DummyWebElement dummy5 = new DummyWebElement();
                dummy5.FakeAttributeItemid    = "231274";
                dummy5.FakeAttributePassageid = "35609";
                DummyWebElement dummy6 = new DummyWebElement();
                dummy6.FakeAttributeItemid    = "231275";
                dummy6.FakeAttributePassageid = "35610";
                DummyWebElement dummy7 = new DummyWebElement();
                dummy7.FakeAttributeItemid    = "231276";
                dummy7.FakeAttributePassageid = "35611";
                DummyWebElement dummy8 = new DummyWebElement();
                dummy8.FakeAttributeItemid    = "231277";
                dummy8.FakeAttributePassageid = "35612";
                DummyWebElement dummy9 = new DummyWebElement();
                dummy9.FakeAttributeItemid    = "231278";
                dummy9.FakeAttributePassageid = "35613";
                DummyWebElement dummy10 = new DummyWebElement();
                dummy10.FakeAttributeItemid    = "231279";
                dummy10.FakeAttributePassageid = "35614";

                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3, dummy4, dummy5, dummy6, dummy7, dummy8, dummy9, dummy10
                };
                ItemCentralResultsWebElementList = new ReadOnlyCollection <IWebElement>(list);
            }

            int index = 0;

            foreach (var webElement in ItemCentralResultsWebElementList)
            {
                int    itemid    = -1;
                int    passageid = -1;
                string uniqueId  = null;
                switch (ItemCentralType)
                {
                case ItemCentralType.Item:
                    itemid    = int.Parse(webElement.GetAttribute("itemid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_ItemFinderResults1_gridResults_ctl03_chkItem
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Passage:
                    itemid    = int.Parse(webElement.GetAttribute("passageid"));
                    ItemCheck = new WebElementWrapper(ByCheckItemLocator(itemid));
                    //ctl00_MainContent_ItemFinder1_PassageFinderResults1_gridResults_ctl03_chkPassage
                    ItemCheck.FakeAttributeId = "ctl00_MainContent_ItemFinder1_" + ControlMiddle + "gridResults_ctl03_chkItem";
                    uniqueId = GetUniqueId(ItemCheck, ByCheckItemLocator(itemid));
                    break;

                case ItemCentralType.Rubric:
                    By ByAlink = By.CssSelector("a[id*='ButtonDetails']");
                    WebElementWrapper aLinkElement = new WebElementWrapper(ByAlink);
                    if (Driver.GetType() == typeof(DummyDriver))
                    {
                        aLinkElement.FakeAttributeRubricid = "8560";
                        //ctl00_MainContent_RubricFinder1_RubricFinderResults1_gridResults_ctl03_ButtonDetails
                        aLinkElement.FakeAttributeId = "ctl00_MainContent_RubricFinder1_" + ControlMiddle + "gridResults_ctl03_ButtonDetails";
                    }
                    itemid   = int.Parse(aLinkElement.GetAttribute("rubric_id"));
                    uniqueId = GetUniqueId(aLinkElement, SearchResultsRows.By);
                    break;
                }
                Report.Write("ItemCentralLineItem by itemid: '" + itemid + "'; passageid: '{" + passageid + "'; index: '" + index + "'; uniqueId: '" + uniqueId);
                var lineItem = new ItemCentralLineItem(webElement, ItemCentralType, itemid, index, uniqueId);
                ItemCentralResultsList.Add(lineItem);
                index++;
            }
        }