private static HtmlSpan GetHtmlSpan(string uiTitle, string uiType) { dynamic htmlControl = new HtmlSpan(Browser.Locate(uiTitle, uiType)); htmlControl.TechnologyName = TechnologyNameWeb; return(htmlControl); }
public void SetGetValuesFromDOM() { // HtmlControl/Elements now have a generic SetValue/GetValue that allows developers // to set/get values directly from the DOM for any property on the control. Whether it is inherited, // readonly or an emitted attribute. // Get whether a checkbox is enabled or disabled. HtmlInputCheckBox cks = Find.ById <HtmlInputCheckBox>("checkbox1"); bool disabled = cks.GetValue <bool>("disabled"); // Disable it cks.SetValue <string>("disabled", "true"); Assert.IsTrue(cks.GetValue <bool>("disabled")); // Is it visible. IsVisible follows the CSS chain to determine if the // element is actually visible or not. An element is visible when // the CSS the display style is not 'none' and the visibility style // is not 'hidden'. Assert.IsTrue(cks.IsVisible()); // Get the color style HtmlSpan mySpan = Find.ById <HtmlSpan>("Warning"); HtmlStyle styleColor = mySpan.GetStyle("color"); string strColor = mySpan.GetStyleValue("color"); // Getting the computed style will follow the CSS chain and return the // style. HtmlStyle styleMargin = mySpan.GetComputedStyle("margin"); string strMargin = mySpan.GetComputedStyleValue("margin"); }
public void LocalAppLoginTest() { // RD(); BrowserWindow browser = BrowserWindow.Launch("http://10.23.66.126:84/Login.aspx"); HtmlEdit uname = new HtmlEdit(browser); HtmlEdit pass = new HtmlEdit(browser); HtmlButton loginbtn = new HtmlButton(browser); uname.SearchProperties.Add("Id", "TextBox1"); pass.SearchProperties.Add("Id", "TextBox2"); loginbtn.SearchProperties.Add("Id", "Button1"); loginbtn.SearchProperties.Add("TagName", "INPUT"); Keyboard.SendKeys(uname, "testname"); Keyboard.SendKeys(pass, "testpass"); Mouse.Click(loginbtn); HtmlSpan labelHome = new HtmlSpan(browser); labelHome.SearchProperties.Add("InnerText", "Welcome"); //labelHome.WaitForControlExist(45000); //HtmlButton close = new HtmlButton(browser); //close.SearchProperties.Add("FriendlyName", "Close"); //Mouse.Click(close); }
/// <summary> /// Open browser; enter login creds for ECATest; click sign in /// </summary> public void LogintoQA() { #region Variable Declarations WinEdit uIAddressandsearchusinEdit = this.UINewtabInternetExplorWindow.UIAddressBarClient.UIAddressandsearchusinEdit; WinEdit uIItemEdit = this.UINewtabInternetExplorWindow.UIItemWindow.UIItemEdit; WinButton uIGotohttpsecakmtqaazuButton = this.UINewtabInternetExplorWindow.UIPageControlToolBar.UIGotohttpsecakmtqaazuButton; HtmlEdit uIUseraccountEdit = this.UINewtabInternetExplorWindow.UISignintoAzureActiveDDocument.UIUseraccountEdit; HtmlEdit uIPasswordEdit = this.UINewtabInternetExplorWindow.UISignintoAzureActiveDDocument.UIPasswordEdit; HtmlSpan uISigninPane = this.UINewtabInternetExplorWindow.UISignintoAzureActiveDDocument.UISigninPane; #endregion // Go to web page 'about:Tabs' using new browser instance this.UINewtabInternetExplorWindow.LaunchUrl(new System.Uri(this.LogintoQAParams.UINewtabInternetExplorWindowUrl)); // Click 'Address and search using Google' text box Mouse.Click(uIAddressandsearchusinEdit, new Point(26, 10)); // Type 'https://eca-kmt-qa.azurewebsites.net/' in text box Keyboard.SendKeys(uIItemEdit, this.LogintoQAParams.UIItemEditSendKeys, ModifierKeys.None); // Click 'Go to “https://eca-kmt-qa.azurewebsites.net/” (Alt...' button Mouse.Click(uIGotohttpsecakmtqaazuButton, new Point(4, 11)); // Type '*****@*****.**' in 'User account' text box uIUseraccountEdit.Text = this.LogintoQAParams.UIUseraccountEditText; // Type '{Tab}' in 'User account' text box Keyboard.SendKeys(uIUseraccountEdit, this.LogintoQAParams.UIUseraccountEditSendKeys, ModifierKeys.None); // Type '********' in 'Password' text box uIPasswordEdit.Password = this.LogintoQAParams.UIPasswordEditPassword; // Double-Click 'Sign in' pane Mouse.DoubleClick(uISigninPane, new Point(30, 13)); }
public ProjectGanttWindow(MicrosoftDynamics365Window bw) { m_bw = bw; ProjectGanttDocument doc = m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument; m_filterButton = doc.FilterButton.ItemPane; m_saveChangesButtonPane = doc.SaveButton.SavePane; m_expandAllButtonPane = doc.ExpandAllButton.ExpandAllPane; m_collapseAllButtonPane = doc.CollapseAllButton.CollapseallPane; m_geveePane = doc.GanttBasePane.GeveePane; m_addNewProjectPane = doc.AddNewProjectCustom.AddnewprojectPane; m_newProjectPane = doc.GanttBasePane.NewProjectPane; m_addChildTaskPane = doc.AddChildTaskCustom.AddChildTaskPane; m_projectItemEdit = doc.EditProjectTaskWindowPane.ItemEdit; m_projectOkLabel = doc.EditProjectTaskWindowPane.OKLabel; m_resourceCategoryPane = doc.EditProjectTaskResourceRolePane.ItemPane; m_developerJuniorPane = doc.DeveloperJuniorPane; m_itemStatusPane = doc.ItemStatusPane; m_chargeableCustom = doc.ChargeableCustom; m_projectNameEdit = doc.PromxCreateNewProjPane.ProjectNameItemEdit; m_selectBillingTypePane = doc.PromxCreateNewProjPane.SelectBillingTypePane; m_OKButton = doc.PromxCreateNewProjPane.OKButton; m_itemPane1 = doc.UIPromx_create_new_proPane1.ProjectManagerItemPane; m_itemEdit1 = doc.ItemEdit; m_itemCustom = doc.ItemCustom; m_itemCustom1 = doc.ItemCustom1; m_userNamePane = doc.UserNamePane; m_addButton = doc.AddButton; m_expandProjectFirstLevel = doc.GanttBasePane.ExpandFirstLevelItemPane; m_expandProjectSecondLevel = doc.GanttBasePane.ExpandSecondLevelItemPane; m_task1Pane = doc.GanttBasePane.Task1Pane; m_deleteMenuPane = doc.DeleteCustom.DeletePane; }
protected Control FormatCandidate(DataRow candidate, bool showIncumbent, bool showParty) { var placeHolder = new PlaceHolder(); new LiteralControl(Politicians.FormatName(candidate, true)).AddTo(placeHolder); if (showIncumbent && candidate.IsIncumbent()) { new LiteralControl(" *").AddTo( new HtmlSpan().AddTo(placeHolder, "incumbent")); } if (!showParty || string.IsNullOrWhiteSpace(candidate.PartyCode())) { return(placeHolder); } var span = new HtmlSpan().AddTo(placeHolder, "party"); new Literal { Text = " - " }.AddTo(span); FormatPartyAnchor(candidate) .AddTo(span); return(placeHolder); }
public void SetOccupation(OccupationType occupation) { HtmlSpan occupationInput = this.Find.AllByTagName <HtmlSpan>("span").Where(s => s.InnerText.Contains("Изберете занимание")).FirstOrDefault(); occupationInput.Click(); HtmlUnorderedList occupationList = this.Find.ById <HtmlUnorderedList>("WorkEducationStatusId_listbox"); switch (occupation) { case OccupationType.Ученик: occupationList.Find.ByContent <HtmlListItem>("Ученик").Click(); break; case OccupationType.Студент: occupationList.Find.ByContent <HtmlListItem>("Студент").Click(); break; case OccupationType.аботещ: occupationList.Find.ByContent <HtmlListItem>("Работещ").Click(); break; default: occupationList.Find.ByContent <HtmlListItem>("Друго").Click(); break; } }
/// <summary> /// Click unsubscribe link /// </summary> public void ClickUnsubscribeLink() { HtmlSpan unsubscribeForEmail = this.EM.CommentsAndReviews.CommentsFrontend.UnsubscribeLink.AssertIsPresent("unsubscribe link"); unsubscribeForEmail.MouseClick(); ActiveBrowser.WaitUntilReady(); }
/// <summary> /// Gets the Edit option from a widget in the form dropzone /// </summary> /// <param name="widget">The widget to search in.</param> /// <returns>The edit link</returns> private HtmlSpan GetEditOption(HtmlDiv widget) { HtmlSpan editOption = widget.Find.ByExpression <HtmlSpan>("class=rdEditCommand", "innertext=Edit") .AssertIsPresent("Edit Link"); return(editOption); }
/// <summary> /// Verify average raiting /// </summary> /// <param name="expectedRaiting">Expected raiting</param> public void VerifyAverageRaiting(string expectedRaiting) { HtmlDiv averageDiv = this.EM.CommentsAndReviews.CommentsFrontend.MessageAndCountOnPage.AssertIsPresent("Comments count on page"); HtmlSpan actualRaiting = averageDiv.Find.ByExpression <HtmlSpan>("tagname=span", "class=text-muted sf-Ratings-average"); Assert.AreEqual(expectedRaiting, actualRaiting.InnerText, "Expected raitng and actual raiting"); }
/// <summary> /// Creates a new test status control on the webpage, within the /// parentElement. /// </summary> public CurrentTestStatus() { SetStyleAttribute(CssAttribute.Position, "relative"); Height = 40; SetStyleAttribute(CssAttribute.MarginBottom, new Unit(6)); BorderColor = Color.VeryLightGray; BorderStyle = BorderStyle.Solid; BorderWidth = 1; _status = new HtmlSpan(); _status.Margin.All = 0; _status.Margin.Left = 4; _details = new HtmlSpan(); _details.Margin.All = 0; _details.Margin.Left = 4; RevertFinalStyle(); _total = CreateCounterDiv(); _fail = CreateCounterDiv(); _fail.SetStyleAttribute(CssAttribute.Right, new Unit(35, UnitType.Pixel)); Controls.Add(_status); Controls.Add(new HtmlLineBreak()); Controls.Add(_details); Controls.Add(_total); Controls.Add(_fail); }
/// <summary> /// Click subscribe for new comment link /// </summary> public void ClickSubscribeToNewCommentLinks() { HtmlSpan subscribeForEmail = this.EM.CommentsAndReviews.CommentsFrontend.SubscribeToNewComments.AssertIsPresent("Subscribe to new comment"); subscribeForEmail.MouseClick(); ActiveBrowser.WaitUntilReady(); }
protected static Control FormatPoliticianWebsite(DataRow politician, string text = "►Website") { Control control; var publicWebAddress = politician.PublicWebAddress(); if (!IsNullOrEmpty(publicWebAddress)) { control = new PlaceHolder(); var span = new HtmlSpan().AddTo(control); var anchor = CreatePoliticianWebsiteAnchor(publicWebAddress, text, publicWebAddress); anchor.AddTo(span); if (anchor is HtmlAnchor) { (anchor as HtmlAnchor).Attributes["rel"] = "nofollow"; } } else { control = new Literal(); } return(control); }
public HtmlControl SelectFromDropdown(string sclass, string data, string ddname = "Operator") { // TODO: Hack just now - kendo combo boxes are weird!! // find dropdown and clck HtmlSpan input = new HtmlSpan(BrowserWindow); input.SearchProperties[HtmlEdit.PropertyNames.Class] = sclass; input.SearchProperties[HtmlEdit.PropertyNames.TagName] = "SPAN"; input = input.FindMatchingControls().First(x => x.FriendlyName == ddname) as HtmlSpan; // defaults for filter dd var n = input.GetChildren(); var k = n[1].GetChildren(); // options foreach (var v in k) { var tv = v as HtmlControl; if (tv.ValueAttribute == data) { Keyboard.SendKeys("{ENTER}"); return(tv); } else { Keyboard.SendKeys("{DOWN}"); } } return(input); }
/// <summary> /// Allow the Details control to decorate the parent container. /// </summary> /// <returns>Returns a set of control bases to decorate with.</returns> public override IEnumerable <HtmlControlBase> DecorateContainer() { string type = Inspector.Result.Exception.GetType().ToString(); if (type.Contains(Utf)) { type = type.Remove(0, Utf.Length); } if (type.StartsWith("System.", StringComparison.OrdinalIgnoreCase)) { type = type.Substring(7); } string message = Inspector.Result.Exception.Message; HtmlSpan ce = new HtmlSpan(); ce.InnerHtml = type; ce.SetStyleAttribute(CssAttribute.Display, CssDisplay.InlineBlock); ce.Margin.All = 2; ce.Padding.All = 4; ce.BackgroundColor = Color.Tan; yield return(ce); HtmlSpan oc = new HtmlSpan(); oc.InnerText = " occurred"; yield return(oc); HtmlDiv cm = new HtmlDiv(); cm.Margin.All = 4; cm.Padding.All = 1; cm.InnerHtml = message; yield return(cm); }
public void SetUniversity(University university) { HtmlSpan universityInput = this.Find.AllByTagName <HtmlSpan>("span").Where(s => s.InnerText.Contains("Изберете университет")).FirstOrDefault(); universityInput.Click(); HtmlUnorderedList universityList = this.Find.ById <HtmlUnorderedList>("UniversityId_listbox"); switch (university) { case University.АграренУниверситетПловдив: universityList.Find.ByContent <HtmlListItem>("Аграрен университет - Пловдив").Click(); break; case University.АкадемияЗаМузикалноТанцовоИзобразителноИзкуствоПловдив: universityList.Find.ByContent <HtmlListItem>("Академия за музикално, танцово и изобразително изкуство - Пловдив").Click(); break; case University.АкадемияНаМврСофия: universityList.Find.ByContent <HtmlListItem>("Академия на МВР - София").Click(); break; default: universityList.Find.ByContent <HtmlListItem>("Американски университет в България - Благоевград").Click(); break; } }
public void SetBirthPlace(BirthPlace birthPlace) { HtmlSpan birthPlaceInput = this.Find.AllByTagName <HtmlSpan>("span").Where(s => s.InnerText.Contains("Изберете град")).FirstOrDefault(); birthPlaceInput.Click(); HtmlUnorderedList birthPlaceList = this.Find.ById <HtmlUnorderedList>("CityId_listbox"); switch (birthPlace) { case BirthPlace.Айтос: birthPlaceList.Find.ByContent <HtmlListItem>("Айтос").Click(); break; case BirthPlace.Аксаково: birthPlaceList.Find.ByContent <HtmlListItem>("Аксаково").Click(); break; case BirthPlace.Алфатар: birthPlaceList.Find.ByContent <HtmlListItem>("Алфатар").Click(); break; case BirthPlace.Антоново: birthPlaceList.Find.ByContent <HtmlListItem>("Антоново").Click(); break; default: birthPlaceList.Find.ByContent <HtmlListItem>("Антоново").Click(); break; } }
public void Get_UsingMultipleValuesOfClassAttributeWithContainsOperatorOfHtmlSpan_ReturnsTheSpecificElementWithAllSpecifiedClassValues() { // Arrange using (TempFile tempFile = new TempFile( @"<html> <head> <title>test</title> </head> <body> <span name=""span1"" class=""class1"" /> <span name=""span2"" class=""class1 class4"" /> <span name=""span3"" class=""class1 class2 class3"" /> </body> </html>")) { BrowserWindow.Launch(tempFile.FilePath); var window = new BrowserWindowUnderTest("test"); HtmlSpan span3 = window.Find <HtmlSpan>(By .Class("class1", PropertyExpressionOperator.Contains) .AndClass("class2", PropertyExpressionOperator.Contains)); // Act and Assert Assert.AreEqual("span3", span3.SourceControl.Name); window.Close(); } }
public void Get_UsingMultipleValuesOfClassAttributeWithContainsOperatorOfHtmlSpan_ReturnsTheSpecificElementWithAllSpecifiedClassValues() { // Arrange using (var webPage = new TempWebPage( @"<html> <head> <title>test</title> </head> <body> <span name=""span1"" class=""class1"" /> <span name=""span2"" class=""class1 class4"" /> <span name=""span3"" class=""class1 class2 class3"" /> </body> </html>")) { var browserWindow = BrowserWindow.Launch(webPage.FilePath); HtmlSpan span3 = browserWindow.Find <HtmlSpan>(By .ClassContains("class1") .AndClassContains("class2")); // Act and Assert Assert.AreEqual("span3", span3.SourceControl.Name); browserWindow.Close(); } }
public void Visit(HtmlSpan h) { if (h.Container is HtmlDiv) { sb.AppendLine(); sb.Append(Tabs(h.Depth)); } sb.Append(string.Format("<{0}", h.Tag)); foreach (var a in h.Attributes.Where(a => a.IsSet)) { sb.Append(a); } sb.Append(">"); foreach (var c in h.Contents) { Visit(c); } sb.Append(string.Format("</{0}>", h.Tag)); if (h.Container is HtmlDiv) { sb.AppendLine(); } }
/// <summary> /// Opens the external urls tab. /// </summary> public void OpenExternalUrlsTab() { HtmlSpan externalUrlsTab = this.EM.Selectors.SelectorsScreen.ExternalUrlsTab.AssertIsPresent("external urls tab"); externalUrlsTab.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// Opens the all tab. /// </summary> public void OpenAllTab() { HtmlSpan allTab = this.EM.Selectors.SelectorsScreen.AllTab.AssertIsPresent("all tab"); allTab.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// Clicks the select category button. /// </summary> public void ClickSelectCategoryButton() { HtmlSpan select = this.EM.Media.MediaUploadPropertiesScreen.SelectButtons.LastOrDefault().AssertIsPresent("select button"); select.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// copy - Use 'copyExpectedValues' to pass parameters into this method. /// </summary> public void copy() { #region Variable Declarations HtmlSpan uIAmitprodPane = this.UIInstallationWizardWindow.UIItemClient.UISignupWizardEngineDocument.UIAmitprodPane; #endregion // Verify that 'amit prod' pane's property 'Id' contains 'signatureName' StringAssert.Contains(uIAmitprodPane.Id, this.copyExpectedValues.UIAmitprodPaneId); }
/// <summary> /// Opens the selected tab. /// </summary> public void OpenSelectedTab() { HtmlSpan selectedTab = this.EM.Widgets.FeatherWidget.SelectedTab .AssertIsPresent("selected tab"); selectedTab.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// Opens the all tab. /// </summary> public void OpenAllTab() { HtmlSpan allTab = this.EM.Widgets.FeatherWidget.AllTab .AssertIsPresent("all tab"); allTab.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// Clicks Bootstrap grid widget button. /// </summary> public void ClickBootstrapGridWidgetButton() { HtmlSpan gridButton = this.EM.Widgets.GridWidgets.BootstrapGridWidget .AssertIsPresent("Bootstrap grid widget button"); gridButton.ScrollToVisible(); gridButton.Focus(); gridButton.MouseClick(); }
/// <summary> /// Assert_ShouldShowFirstNameAsRequiredForEmptyFirstNameValue - Use 'Assert_ShouldShowFirstNameAsRequiredForEmptyFirstNameValueExpectedValues' to pass parameters into this method. /// </summary> public void Assert_ShouldShowFirstNameAsRequiredForEmptyFirstNameValue() { #region Variable Declarations HtmlSpan uIRequiredPane1 = this.UIEmployeeDetailsPageWWindow.UIEmployeeDetailsPageDocument.UIRequiredPane1; #endregion // Verify that 'Required' pane's property 'InnerText' equals 'Required' Assert.AreEqual(this.Assert_ShouldShowFirstNameAsRequiredForEmptyFirstNameValueExpectedValues.UIRequiredPane1InnerText, uIRequiredPane1.InnerText); }
/// <summary> /// Clicks the select library button. /// </summary> public void ClickSelectLibraryButton() { this.EM.Media.MediaUploadPropertiesScreen.UploadDisabledButton.AssertIsPresent("Upload disabled button"); HtmlSpan select = this.EM.Media.MediaUploadPropertiesScreen.SelectButtons.FirstOrDefault().AssertIsPresent("select button"); select.Click(); ActiveBrowser.WaitForAsyncRequests(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// AssertMethod2 - Use 'AssertMethod2ExpectedValues' to pass parameters into this method. /// </summary> public void AssertMethod2() { #region Variable Declarations HtmlSpan uISuccessPane = this.UINewtabInternetExplorWindow.UIHomePageMyASPNETApplDocument.UISuccessPane; #endregion // Verify that the 'DisplayText' property of 'Success' pane equals 'Success' Assert.AreEqual(this.AssertMethod2ExpectedValues.UISuccessPaneDisplayText, uISuccessPane.DisplayText); }
private void SearchAndSelectElementByExpandingArrows(ICollection<HtmlSpan> arrows, HtmlSpan element, string itemName, HtmlDiv activeTab) { if (this.isHierarchicalItemFound) { return; } foreach (var arrow in arrows) { if (this.isHierarchicalItemFound) { return; } if (arrow.IsVisible()) { arrow.Click(); activeTab.Refresh(); element = activeTab.Find.ByCustom<HtmlSpan>(a => a.InnerText.Equals(itemName)); if (element != null && element.IsVisible()) { element.Click(); this.isHierarchicalItemFound = true; } else { var newArrows = this.EM.Widgets.WidgetDesignerContentScreen.Find.AllByCustom<HtmlSpan>(a => a.CssClass.Contains("k-icon k-plus")); if (newArrows.Count != 0) { this.SearchAndSelectElementByExpandingArrows(newArrows, element, itemName, activeTab); } else { throw new Exception(itemName + " " + "not found"); } } } } }