Example #1
0
        public void CodedUITestMethod1()
        {
            HtmlCustom brandAmazon = new HtmlCustom(br);

            brandAmazon.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "LI");
            brandAmazon.SearchProperties.Add(HtmlCustom.PropertyNames.Class, "refinementImage");
            //brandAmazon.DrawHighlight();
            System.Drawing.Point myPoint = new System.Drawing.Point(100, 100);
            Mouse.Move(brandAmazon, myPoint);

            HtmlHyperlink bAmazonLink = new HtmlHyperlink(brandAmazon);

            bAmazonLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, " Amazon  (1,156) ");
            bAmazonLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.TagName, "A");
            bAmazonLink.DrawHighlight();
            Mouse.Click(bAmazonLink);

            HtmlSpan facebookOption = new HtmlSpan(br);

            facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.TagName, "SPAN");
            facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.Class, "bestLink");
            facebookOption.SearchProperties.Add(HtmlSpan.PropertyNames.InnerText, "Facebook");
            Mouse.Click(facebookOption);

            HtmlCustom searchSortForm = new HtmlCustom(br);

            searchSortForm.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "FORM");
            searchSortForm.SearchProperties.Add(HtmlCustom.PropertyNames.Class, "sortByForm");
            searchSortForm.DrawHighlight();

            HtmlComboBox sort = new HtmlComboBox(searchSortForm);

            sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Id, "sort");
            sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Name, "sort");
            sort.SearchProperties.Add(HtmlComboBox.PropertyNames.Class, "sortByDropdown");
            sort.SelectedIndex = 4;

            for (int i = 1; i <= 24; i++)
            {
                HtmlCustom giftTitle = new HtmlCustom(br);
                giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.TagName, "H3");
                giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, "Amazon.com Gift Cards - Facebook Delivery ");
                giftTitle.SearchProperties.Add(HtmlCustom.PropertyNames.TagInstance, "'" + i + "'");
                giftTitle.DrawHighlight();

                HtmlHyperlink giftTitle1 = new HtmlHyperlink(giftTitle);
                giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, "Amazon.com Gift Cards - Facebook Delivery");
                giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.TagName, "A");
                giftTitle1.SearchProperties.Add(HtmlHyperlink.PropertyNames.ClassName, "HtmlHyperlink");
                string s = HtmlHyperlink.PropertyNames.FriendlyName;

                if (s == "Amazon.com Gift Cards - Facebook Delivery")
                {
                    Console.WriteLine("Mathced!");
                }
            }
        }
Example #2
0
        /// <summary>
        /// ClickFirstHtmlTablesLink
        /// </summary>
        public void ClickFirstHtmlTablesLink()
        {
            #region Variable Declarations
            HtmlHyperlink uIHTMLTablesHyperlink = this.UIW3SchoolsOnlineWebTuWindow.UIW3SchoolsOnlineWebTuDocument.UI___gcse_0Pane1.UIHTMLTablesHyperlink;
            uIHTMLTablesHyperlink.DrawHighlight();
            #endregion

            // Click 'HTML Tables' link
            Mouse.Click(uIHTMLTablesHyperlink, new Point(111, 8));
        }
Example #3
0
        /// <summary>
        /// ClickSearchIconToOpenSearchBox
        /// </summary>
        public void ClickSearchIconToOpenSearchBox()
        {
            #region Variable Declarations
            HtmlHyperlink uIItemHyperlink = this.UIW3SchoolsOnlineWebTuWindow.UIW3SchoolsOnlineWebTuDocument.UIItemHyperlink;
            uIItemHyperlink.DrawHighlight();
            #endregion

            // Click '' link
            Mouse.Click(uIItemHyperlink, new Point(30, 36));
        }
        // To click on a specific hyperlink
        public void clickHTMLHyperlinkOneProp(string strControl)
        {
            Keywords      KeyFound       = reader.FindControlinList(strControl);
            BrowserWindow _browser       = new BrowserWindow();
            HtmlHyperlink _htmlHyperlink = new HtmlHyperlink(_browser);

            _htmlHyperlink.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1;
            _htmlHyperlink.SearchProperties[KeyFound.PropertyName2] = KeyFound.PropertyValue2;
            _htmlHyperlink.SearchProperties[KeyFound.PropertyName3] = KeyFound.PropertyValue3;
            _htmlHyperlink.WaitForControlExist();
            //Mouse.Click(_htmlHyperlink);
            _htmlHyperlink.DrawHighlight();
        }