private static HtmlDocument NavigateToAboutPage(BrowserWindow browser, HtmlDocument page) { // Click the "About" Hyperlink HtmlHyperlink aboutHyperlink = new HtmlHyperlink(page); aboutHyperlink.SearchProperties[HtmlHyperlink.PropertyNames.Id] = "about"; aboutHyperlink.WaitForControlExist(); Mouse.Click(aboutHyperlink); page = new HtmlDocument(browser); return(page); }
// 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(); }
public static void ClickLinkByName(string name) { #region Variable Declarations HtmlHyperlink lnk = new HtmlHyperlink(browserWindow); lnk.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, name, PropertyExpressionOperator.EqualTo); lnk.SearchProperties.Add(HtmlCustom.PropertyNames.InnerText, name, PropertyExpressionOperator.Contains); lnk.SearchProperties.Add(HtmlCustom.PropertyNames.FriendlyName, name, PropertyExpressionOperator.Contains); #endregion lnk.WaitForControlExist(); Mouse.Click(lnk); }
// To click on specific hyperlink based on the property from a list of hidden hyperlink controls public void clickHTMLHyperlinkFromHiddenControlsOneProp(string strControl) { Keywords KeyFound = reader.FindControlinList(strControl); BrowserWindow _browser = new BrowserWindow(); HtmlHyperlink _htmlHyperlink = new HtmlHyperlink(_browser); _htmlHyperlink.SearchProperties[KeyFound.PropertyName1] = KeyFound.PropertyValue1; _htmlHyperlink.WaitForControlExist(); UITestControlCollection _uitestControlCollection = _htmlHyperlink.FindMatchingControls(); foreach (UITestControl _uitestControl in _uitestControlCollection) { if (_uitestControl.BoundingRectangle.Width > 0) { Mouse.Click(_uitestControl); break; } } }