Ejemplo n.º 1
0
        /// <summary>
        /// Selecciona la talla
        /// </summary>
        /// <param name="size">La talla</param>
        /// <returns><see cref="ResultsSearch"/></returns>
        public ResultsSearch SelectSize(int size)
        {
            // Busca el elemento de la talla
            HtmlControl containerSize = new HtmlControl(UIResultsPage.Body.ContainerPane.ContainerSize);

            containerSize.SearchProperties[HtmlControl.PropertyNames.TagName] = "span";
            containerSize.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, size.ToString(), PropertyExpressionOperator.Contains);
            UITestControl sizeElement = containerSize.FindMatchingControls().FirstOrDefault();

            // Selecciona la talla
            UITestControl parent = sizeElement.GetParent();

            Mouse.Click(parent);

            // Imprime el número de resultados
            Thread.Sleep(TimeSpan.FromSeconds(5));
            HtmlControl numberResultsElement = UIResultsPage.Body.HeaderResults.NumberResults;
            string      numberResults        = numberResultsElement.InnerText;
            string      msg = string.Format("La cantidad de resultados con la talla {0} es de {1}",
                                            size.ToString(),
                                            numberResultsElement);

            Console.WriteLine(msg);

            return(new ResultsSearch());
        }
Ejemplo n.º 2
0
        public FDMPage ClickOnTheFormInGrid()
        {
            HtmlControl btn = new HtmlControl(_bw);

            btn.SearchProperties.Add(HtmlControl.PropertyNames.Class, "gridcheckbox");
            UITestControlCollection collection = btn.FindMatchingControls();

            collection[0].DrawHighlight();

            Mouse.Click(collection[0]);
            return(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ordena por precio de forma ascendente
        /// </summary>
        /// <param name="typeSorting">Tipo de ordenamiento</param>
        private void SortResults(string typeSorting)
        {
            // Despliega el listado para ordenar
            Mouse.Click(UIResultsPage.Body.ContainerOrderBy.OrderBy);

            // Selecciona la opción de ordenamiento
            HtmlControl listOrderBy = new HtmlControl(UIResultsPage.Body.ContainerOrderBy);

            listOrderBy.SearchProperties[HtmlControl.PropertyNames.InnerText] = typeSorting;
            listOrderBy.SearchProperties[HtmlControl.PropertyNames.TagName]   = "a";
            UITestControl elementOrderBy = listOrderBy.FindMatchingControls().FirstOrDefault();

            Mouse.Click(elementOrderBy);
        }
Ejemplo n.º 4
0
        public FDMPage ClickExportToPDFOnActionsButton()
        {
            HtmlControl btn = new HtmlControl(_bw);

            btn.SearchProperties.Add(HtmlControl.PropertyNames.Class, "ng-scope openleft");
            UITestControlCollection collection = btn.FindMatchingControls();

            collection[2].DrawHighlight();

            Point location = collection[2].BoundingRectangle.Location;

            location.Offset(collection[2].BoundingRectangle.Width / 2,
                            collection[2].BoundingRectangle.Height / 2);

            Mouse.Click(location);
            return(this);
        }
Ejemplo n.º 5
0
        public FDMPage SelectMeetingMinutesFormFromTheList()
        {
            HtmlControl mMForm = new HtmlControl(_bw);

            mMForm.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Meeting Minutes");
            mMForm.SearchProperties.Add(HtmlControl.PropertyNames.Class, "ng-binding ng-scope");
            mMForm.SearchProperties.Add(HtmlControl.PropertyNames.ValueAttribute, "e08d4769-6c86-43bb-a6f4-8e687915d5ec");
            UITestControlCollection collection = mMForm.FindMatchingControls();

            collection[0].DrawHighlight();

            Point location = collection[0].BoundingRectangle.Location;

            location.Offset(collection[0].BoundingRectangle.Width / 2,
                            collection[0].BoundingRectangle.Height + 5);
            Mouse.Click(location);
            return(this);
        }
Ejemplo n.º 6
0
        public FDMPage ExpandFormsList()
        {
            HtmlControl btn = new HtmlControl(_bw);

            btn.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Choose a Form Definition from the List Below");


            UITestControlCollection collection = btn.FindMatchingControls();

            collection[0].DrawHighlight();

            Point location = collection[0].BoundingRectangle.Location;

            location.Offset(collection[0].BoundingRectangle.Width / 2,
                            collection[0].BoundingRectangle.Height / 2);
            Mouse.Click(location);
            return(this);
        }
Ejemplo n.º 7
0
        // To check for all hyperlinks inside custom control
        public void searchHTMLHyperlinksInsideCustomTwoProp(HtmlTable UITable, string strControl)
        {
            Keywords   KeyFound    = reader.FindControlinList(strControl);
            HtmlCustom _htmlCustom = new HtmlCustom(UITable);

            _htmlCustom.SearchProperties.Add("ControlType", "Custom");
            _htmlCustom.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1;
            _htmlCustom.SearchProperties[KeyFound.PropertyName2] = KeyFound.PropertyValue2;
            HtmlControl _htmlControl = new HtmlControl(_htmlCustom);

            _htmlControl.SearchProperties.Add(HtmlControl.PropertyNames.ClassName, "HtmlHyperlink");
            UITestControlCollection _uitestControlCollection = _htmlControl.FindMatchingControls();

            foreach (UITestControl links in _uitestControlCollection)
            {
                //cast the item to HtmlHyperlink type
                HtmlHyperlink _htmlHyperlink = (HtmlHyperlink)links;
                //get the innertext from the link, which inturn returns the link value itself
                Console.WriteLine(_htmlHyperlink.InnerText);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Realiza la búsqueda avanazada de un artículo
        /// </summary>
        /// <param name="article"><see cref="Article"/></param>
        /// <returns><see cref="ResultsSearch"/></returns>
        public ResultsSearch SearchArticle(Article article)
        {
            // Ingresa la palabra clave
            Keyboard.SendKeys(UISearchAdvancedPage.Body.KeyWordArticle, article.KeyWord);

            // Selecciona la categoría
            Mouse.Click(UISearchAdvancedPage.Body.Category);
            HtmlControl bodyElement = new HtmlControl(UISearchAdvancedPage.Body);

            bodyElement.SearchProperties[HtmlControl.PropertyNames.TagName] = "option";
            bodyElement.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, article.Category, PropertyExpressionOperator.Contains);
            HtmlControl categoryElement = (HtmlControl)bodyElement.FindMatchingControls().FirstOrDefault();

            Keyboard.SendKeys(categoryElement, categoryElement.InnerText);
            Keyboard.SendKeys(categoryElement, "{ESCAPE}");

            // Hace clic en el botón buscar
            Mouse.Click(UISearchAdvancedPage.Body.ContainerSearch.ButtonSearch);

            return(new ResultsSearch());
        }
Ejemplo n.º 9
0
        //Function applicable to particular Websites
        // To check for all hyperlinks inside div control
        public void searchHTMLHyperlinksInsideDivOneProp(string strControl)
        {
            Keywords KeyFound = reader.FindControlinList(strControl);
            //Search for the Div which has the list of hyperlinks we are searching
            HtmlDiv _htmlDiv = new HtmlDiv();

            _htmlDiv.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1;
            _htmlDiv.SearchProperties[KeyFound.PropertyName2] = KeyFound.PropertyValue2;
            //Pass the instance of Div to HtmlControl class
            HtmlControl _htmlControl = new HtmlControl(_htmlDiv);

            _htmlControl.SearchProperties.Add(HtmlControl.PropertyNames.ClassName, "HtmlHyperlink");
            UITestControlCollection _uitestControlCollection = _htmlControl.FindMatchingControls();

            foreach (UITestControl links in _uitestControlCollection)
            {
                //cast the item to HtmlHyperlink type
                HtmlHyperlink _htmlHyperlink = (HtmlHyperlink)links;
                //get the innertext from the link, which inturn returns the link value itself
                Console.WriteLine(_htmlHyperlink.InnerText);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Obtiene la cantidad de productos
        /// </summary>
        /// <param name="quantity">La cantidad</param>
        /// <returns><see cref="Article"/></returns>
        public ResultsSearch GetProducts(int quantity)
        {
            Thread.Sleep(TimeSpan.FromSeconds(5));
            HtmlControl body = new HtmlControl(UIResultsPage.Body);

            body.SearchProperties[HtmlControl.PropertyNames.Id] = "ListViewInner";
            UITestControl               ulElement            = body.FindMatchingControls().FirstOrDefault();
            UITestControlCollection     listProductsChildren = ulElement.GetChildren();
            IEnumerable <UITestControl> CollectionProducts   = listProductsChildren.Take(quantity);

            // Obtiene el nombre y precio de cada uno de los productos y lo asigna al listado
            int aux = 0;

            foreach (HtmlControl product in CollectionProducts)
            {
                aux += 1;
                string msg = string.Format("Información del producto {0}", aux);
                Console.WriteLine(msg);
                Article article = new Article();

                // Nombre del producto
                HtmlControl productElement = product;
                productElement.SearchProperties[HtmlControl.PropertyNames.TagName] = "h3";
                productElement.SearchProperties[HtmlControl.PropertyNames.Class]   = "lvtitle";
                productElement.FindMatchingControls();
                string name = string.Format("    Nombre: {0}", productElement.InnerText);
                Console.WriteLine(name);

                // Precio del producto
                product.SearchProperties[HtmlControl.PropertyNames.TagName] = "li";
                product.SearchProperties[HtmlControl.PropertyNames.Class]   = "lvprice prc";
                product.FindMatchingControls();
                string price = string.Format("    Precio: {0}", product.InnerText);
                Console.WriteLine(price);
            }

            return(new ResultsSearch());
        }
Ejemplo n.º 11
0
        public void PACSSystem()
        {
            WriteLogs("########## START ########## PAC System " + DateTime.Now.ToString() + "##########");
            //Open Browser, Clear Local Storage Data and again Open Browser
            pacsLoginPage.openBrowser(strURL);
            Playback.Wait(5);
            pacsLoginPage.browserAction_Obj.browserAction_method();
            Playback.Wait(10000);
            pacsLoginPage.closeBrowser();
            pacsLoginPage.openBrowser(strURL);
            Playback.Wait(3000);

            //Enter Valid Username
            pacsLoginPage.enterUserName(userName);

            //Enter Valid PAssword
            pacsLoginPage.enterPD(passWord);
            pacsLoginPage.clicksigninbutton(0);
            Playback.Wait(6000);
            pacsLoginPage.clicksigninbutton(1);

            //Click on the New PACS Icon
            pacsMainMenuPage.clickcreateNewPackIcon();

            //Enter Book Ref Character
            pacsQuestionPage.enterBookRef(bookRefChar);

            //Select Booking Reference Number from the Booking referene List
            HtmlDiv bookRefListDiv = new HtmlDiv(_mainPageDoc);

            bookRefListDiv.SearchProperties[HtmlDiv.PropertyNames.Id] = "bookingNamesContainer";
            HtmlControl bookRefList = new HtmlControl(bookRefListDiv);

            bookRefList.SearchProperties.Add(HtmlControl.PropertyNames.Class, "aBooking");
            UITestControlCollection collectionBookRef = bookRefList.FindMatchingControls();
            Random        rad              = new Random();
            int           bookRefCount     = rad.Next(collectionBookRef.Count);
            UITestControl bookingRef       = collectionBookRef[bookRefCount];
            HtmlDiv       selectBookingRef = (HtmlDiv)bookingRef;

            pacsQuestionPage.selectBookRef(selectBookingRef);

            //Select Questions Answer
            HtmlDiv questionColl = new HtmlDiv(_mainPageDoc);

            questionColl.SearchProperties[HtmlDiv.PropertyNames.Id] = "dvQuestionContainer";

            HtmlCustom allQuestionList = new HtmlCustom(questionColl);

            allQuestionList.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "LI");
            UITestControlCollection QuestionsList = allQuestionList.FindMatchingControls();

            int i = 1;

            foreach (UITestControl ques in QuestionsList)
            {
                if (ques.GetProperty("FriendlyName").ToString() != "")
                {
                    if (ques.GetProperty("innertext").ToString().Replace(" ", "").Trim() != "7.1PoolReadings")
                    {
                        HtmlDiv divfindAns = new HtmlDiv(ques);
                        divfindAns.SearchProperties[HtmlDiv.PropertyNames.Class] = "responseOption";
                        UITestControlCollection answers1 = divfindAns.FindMatchingControls();

                        int    ansCount    = answers1.Count();
                        Random radAns      = new Random();
                        int    ranAnsCount = radAns.Next(ansCount);

                        HtmlDiv ans = (HtmlDiv)answers1[ranAnsCount];

                        bool isClickable = false;
                        while (!isClickable)
                        {
                            try
                            {
                                Mouse.MoveScrollWheel(-1);
                                ans.EnsureClickable();
                                isClickable = true;
                            }
                            catch (Exception)
                            {
                            }
                        }

                        string ansValue = ans.DisplayText;
                        pacsQuestionPage.selectQuestionAns(ans, ques);
                    }

                    else
                    {
                        HtmlEdit enterPoolAns = new HtmlEdit(ques);
                        enterPoolAns.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";
                        UITestControlCollection ansPool = enterPoolAns.FindMatchingControls();

                        int    ansPoOlCount    = ansPool.Count();
                        Random radPoolAns      = new Random();
                        int    ranPoolAnsCount = radPoolAns.Next(ansPoOlCount);

                        HtmlEdit ansPoolReadings = (HtmlEdit)ansPool[ranPoolAnsCount];

                        string poolValue = ansPoolReadings.DefaultText;

                        pacsQuestionPage.selectPoolHeatQuesAns(ansPoolReadings, ques);
                    }
                }
                else
                {
                    pacsQuestionPage.enterMainComment();
                }
                i++;
            }
            WriteLogs("PASS : Total number of Question's answered is - " + i + " : VERIFICATION");

            //Select Save button from Questions Page
            pacsQuestionPage.clickSaveButtons(0);

            //Select on Continue button for some missing Questions.
            HtmlDiv continuePresent = new HtmlDiv(_mainPageDoc);

            continuePresent.SearchProperties[HtmlDiv.PropertyNames.Id] = "cmdCustomMsgBoxContinue";
            var    Mouseposition = continuePresent.BoundingRectangle;
            Point  x             = new Point(Mouseposition.X, Mouseposition.Y);
            Point  y             = new Point(Mouseposition.X - 10, Mouseposition.Y - 10);
            string srchContinoue = continuePresent.InnerText;

            if (x.X != 0)
            {
                pacsQuestionPage.clickContinueButton(continuePresent);

                HtmlDiv allQuestions = new HtmlDiv(_mainPageDoc);
                allQuestions.SearchProperties[HtmlDiv.PropertyNames.Id] = "dvQuestionContainer";

                HtmlDiv errorControl = new HtmlDiv(_mainPageDoc);
                errorControl.SearchProperties.Add(HtmlDiv.PropertyNames.Class, "errorResponse");
                errorControl.SearchProperties.Add(new PropertyExpression(HtmlDiv.PropertyNames.ControlDefinition, "red", PropertyExpressionOperator.Contains));
                UITestControlCollection missingQuestionscoll = errorControl.FindMatchingControls();

                foreach (HtmlDiv missedQuestion in missingQuestionscoll)
                {
                    UITestControl questionsOption = missedQuestion.GetParent();
                    UITestControl questionTitle   = questionsOption.GetParent();

                    HtmlDiv divfindAns = new HtmlDiv(questionsOption);
                    divfindAns.SearchProperties[HtmlDiv.PropertyNames.Class] = "errorResponse";
                    UITestControlCollection answers1 = divfindAns.GetChildren();
                    bool isClickable = false;
                    while (!isClickable)
                    {
                        try
                        {
                            Mouse.MoveScrollWheel(1);
                            questionTitle.EnsureClickable();
                            isClickable = true;
                            Mouse.MoveScrollWheel(-1);
                            questionTitle.EnsureClickable();
                            isClickable = true;
                        }
                        catch (Exception)
                        {
                        }
                    }

                    string[] ansC = questionsOption.FriendlyName.Split(' ');

                    int    ansCount    = ansC.Count();
                    Random radAns      = new Random();
                    int    ranAnsCount = radAns.Next(1, ansCount);

                    HtmlDiv ansValue = (HtmlDiv)answers1[ranAnsCount];

                    pacsQuestionPage.selectedQuestionAnsOption(ansValue, questionTitle);
                }

                //Again click on the Save button for verification of all questions
                pacsQuestionPage.clickSaveButtons(1);
            }

            //Close Browser
            pacsQuestionPage.closeBrowser();

            //Open Browser and click on the Sign In button
            pacsLoginPage.openBrowser(strURL);
            Playback.Wait(1000);
            pacsLoginPage.clicksigninbutton(1);
            Playback.Wait(2000);

            //Searching for any existing PACS Sheet
            HtmlDiv divExistingPACS = new HtmlDiv(_mainPageDoc);

            divExistingPACS.SearchProperties[HtmlDiv.PropertyNames.Id] = "savedPacsList";
            HtmlCustom searchExistingPACS = new HtmlCustom(divExistingPACS);

            searchExistingPACS.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "A");
            if (searchExistingPACS.Exists)
            {
                UITestControlCollection collection = searchExistingPACS.FindMatchingControls();
                Random        radNumSelect         = new Random();
                int           book    = radNumSelect.Next(1, collection.Count);
                UITestControl bookRef = collection[book];
                _existingBookRefPACSIcon = (HtmlCustom)bookRef;
            }
            pacsMainMenuPage.selectExistingBookRefPACS(_existingBookRefPACSIcon);


            HtmlDiv nameOfBtn = new HtmlDiv(_mainPageDoc);

            nameOfBtn.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "bottomRow");

            // HtmlDiv name = new HtmlDiv(HtmlDiv.PropertyNames.Id, "bottomRow");


            //nameOfBtn.SearchProperties[HtmlDiv.PropertyNames.DisplayText] = "Complete & Upload";
            //nameOfBtn.SearchProperties[HtmlDiv.PropertyNames.DisplayText] = "Save";

            // nameOfBtn.SearchProperties.Add(HtmlDiv.PropertyNames.DisplayText, "Complete & Upload", PropertyExpressionOperator.Contains);
            UITestControlCollection nameBtnAll = nameOfBtn.FindMatchingControls();



            Playback.Wait(1000);
            //Click on Complete And Upload Button.
            HtmlDiv completeUploadBtnControl = new HtmlDiv(_mainPageDoc);

            completeUploadBtnControl.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "cmdCompleteUpload");
            pacsQuestionPage.clickCompleteAndUploadButton(completeUploadBtnControl);

            Playback.Wait(1000);
            //Click on the OK button
            HtmlDiv okBtnControl = new HtmlDiv(_mainPageDoc);

            okBtnControl.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "cmdCustomMsgBoxOk");
            pacsQuestionPage.clickOKButton(okBtnControl);
            WriteLogs("########## END ########## PAC System " + DateTime.Now.ToString() + "##########");
        }