public BLResponse<Author> GetAuthors(BLRequest blRequest){ return Client.Execute(proxy=>{ var u= Authors.Get(proxy); var r = new BLResponse<Author>(); if(!IsCayita(blRequest)) r.Result=u; else { HtmlDiv div = new HtmlDiv( ){Name="Author"}; var itag = new HtmlIcon(){ Class="button-add icon-plus-sign", Name="Author" }; div.AddHtmlTag(itag); div.AddHtmlTag(BuildAuthorGrid(u)); HtmlDiv formDiv = new HtmlDiv(){Id="div-form-edit"}; formDiv.Style.Hidden=true; var form = BuildAuthorForm(); form.AddCssClass("span6"); form.Title="Author's Data"; formDiv.AddHtmlTag(form); r.Html= div.ToString()+formDiv.ToString(); } return r; }); }
public BLResponse<Sale> SendSalesRepo(SendSales request, BLRequest blRequest){ var res = new BLResponse<Sale>(); var mailTarget = request.Email; //MailTarget(blRequest); var sales = GetSalesFromRepo(request, blRequest); var gsbv = (from g in sales group g by g.Vendor into r select new SalesByVendor { Vendor= r.Key, Total= r.Sum(p=>p.Price) }).OrderByDescending(f=>f.Total).ToList(); HtmlDiv div = new HtmlDiv(); var gridSalesByVendor =BuildSalesByVendorGrid(gsbv, mailTarget); div.AddHtmlTag(gridSalesByVendor); div.AddHtmlTag( new HtmlLineBreak()); foreach(var sv in gsbv ){ div.AddHtmlTag(( BuildDetails(sv.Vendor, sales.Where(f=>f.Vendor== sv.Vendor).ToList(), mailTarget))); div.AddHtmlTag( new HtmlLineBreak()); } if(mailTarget.IsNullOrEmpty()){ res.Html= div.ToString(); return res; } SendSalesRepoByMail(div, mailTarget); return res; }
public CategoryPage SelectCategory(string categoryName) { HtmlDiv categoryDiv = new HtmlDiv(_bw); categoryDiv.SearchProperties.Add(HtmlControl.PropertyNames.Class, "hidden-xs", PropertyExpressionOperator.Contains); HtmlHyperlink lightingCategoryLink = new HtmlHyperlink(categoryDiv); lightingCategoryLink.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, categoryName, PropertyExpressionOperator.Contains); Mouse.Click(lightingCategoryLink); return new CategoryPage(_bw); }
public ProductDetailsPage SelectProduct(string productName) { HtmlDiv LightingList = new HtmlDiv(_bw); LightingList.SearchProperties.Add(HtmlControl.PropertyNames.Class, "list-item-part", PropertyExpressionOperator.Contains); HtmlHyperlink lightingProduct = new HtmlHyperlink(LightingList); lightingProduct.SearchProperties.Add(HtmlControl.PropertyNames.Title, productName, PropertyExpressionOperator.Contains); Mouse.Click(lightingProduct); return new ProductDetailsPage(_bw); }
public void DuplicateCssWidgetOnPage() { BAT.Macros().NavigateTo().Pages(this.Culture); BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName); HtmlDiv radDockZone = ActiveBrowser.Find .ByExpression <HtmlDiv>("placeholderid=" + "Contentplaceholder1") .AssertIsPresent <HtmlDiv>("Contentplaceholder1"); radDockZone.MouseClick(); BATFeather.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetName); BATFeather.Wrappers().Backend().ScriptAndStyles().CssWidgetEditWrapper().FillCodeInEditableArea(CssValue); BATFeather.Wrappers().Backend().Widgets().WidgetDesignerWrapper().SaveChanges(); BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().SelectExtraOptionForWidget(OperationName); BATFeather.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetName); BATFeather.Wrappers().Backend().ScriptAndStyles().CssWidgetEditWrapper().FillCodeInEditableArea(SecondCssValue); BATFeather.Wrappers().Backend().Widgets().WidgetDesignerWrapper().SaveChanges(); BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage(); this.VerifyCssExistOnTheFrontend(); }
public static bool Open() { HomePage.BrowserInstance.SearchProperties[UITestControl.PropertyNames.Name] = "Fernbrooke Ridge - A Lendlease Community"; HtmlDocument doc = new HtmlDocument(HomePage.BrowserInstance); doc.SearchProperties[HtmlDocument.PropertyNames.Title] = "Fernbrooke Ridge - A Lendlease Community"; doc.SearchProperties[HtmlDocument.PropertyNames.PageUrl] = Constants.FernbrookeHyperlink; HtmlDiv div = new HtmlDiv(doc); div.SearchProperties[HtmlDiv.PropertyNames.Id] = "menu-container"; div.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, "Fernbrooke Ridge", PropertyExpressionOperator.Contains); div.SearchProperties[HtmlDiv.PropertyNames.Class] = "collapse navbar-collapse"; HtmlHyperlink link = new HtmlHyperlink(div); link.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, "Living in Fernbrooke Ridge", PropertyExpressionOperator.Contains); link.SearchProperties[HtmlHyperlink.PropertyNames.Href] = "http://communities.lendlease.com/fernbrooke-ridge/living-in-fernbrooke-ridge"; return link.Exists; }
private void ReportStateContests() { var offices = _DataManager.GetOfficeGroups(new StateFilter()); if (offices.Count == 0) { return; } var officesDiv = new HtmlDiv().AddTo(ReportContainer, "office-cells accordion-content"); foreach (var office in offices) { if (ReportOneOffice(_StateElectionKey, office, officesDiv)) { //_TotalContests++; _AllOffices.Add(office.First().OfficeKey()); } } }
private void SelectElementInTree(string itemName, HtmlDiv activeTab) { var element = activeTab.Find.ByExpression <HtmlSpan>("innertext=" + itemName); if (element != null && element.IsVisible()) { element.Click(); ActiveBrowser.RefreshDomTree(); } else { var arrows = this.EM.Widgets.WidgetDesignerContentScreen.Find.AllByCustom <HtmlSpan>(a => a.CssClass.Contains("k-icon k-plus")); Assert.AreNotEqual(0, arrows.Count, "No arrows appear"); this.SearchAndSelectElementByExpandingArrows(arrows, element, itemName, activeTab); this.isHierarchicalItemFound = false; } }
private static void AddEmailsTo(Control parent, IEnumerable <string> emailList, string name, bool isRadio, bool isOption = false) { parent.Controls.Clear(); var index = 1; foreach (var email in emailList) { var isChecked = index == 1; var id = name + index++; var div = new HtmlDiv().AddTo(parent, "tiptip"); div.Attributes["title"] = email; HtmlInputControl inputControl; if (isRadio) { inputControl = new HtmlInputRadioButton { ID = id, Value = email, Name = name, Checked = isChecked } } ; else { inputControl = new HtmlInputCheckBox { ID = id, Value = email } }; if (isOption) { inputControl.AddCssClasses("is-option-click"); } inputControl.AddTo(div); new HtmlLabel { InnerText = email }.AddTo(div) .Attributes["for"] = id; } } }
public void TestDisabledInput() { HtmlDiv bodyContainerDiv = new HtmlDiv(this.window); bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer"); // no fieldset available HtmlControl fieldset = new HtmlCustom(bodyContainerDiv); fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset"); HtmlEdit disabledInput = new HtmlEdit(fieldset); disabledInput.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "disabledInput"); Assert.IsTrue(disabledInput.TryFind(), "Disabled text box should be able to be found."); try { disabledInput.EnsureClickable(); } catch { } Point p; Assert.IsTrue(disabledInput.TryGetClickablePoint(out p), "There should be a point on screen for the disabled input."); Assert.IsFalse(disabledInput.Enabled); Assert.IsTrue(StringComparer.OrdinalIgnoreCase.Equals("testValue", disabledInput.Text)); try { disabledInput.Text = "Other Value"; Assert.Fail("Attempting to set text of a disabled input should throw an exception."); } catch (ActionNotSupportedOnDisabledControlException) { } Assert.IsTrue(StringComparer.OrdinalIgnoreCase.Equals("testValue", disabledInput.Text)); }
public virtual void Visit(FormGroup formGroup, HtmlContainer htmlContainer) { HtmlDiv htmlDiv = verbose ? new HtmlDiv(formGroup.Path) : new HtmlDiv(); htmlDiv.Class.Add("formGroup"); if (!string.IsNullOrWhiteSpace(formGroup.CssClass)) { htmlDiv.Class.AddRange(formGroup.CssClass.Split(' ').Where(s => s != string.Empty)); } if (formGroup.Container == null) { if (!string.IsNullOrWhiteSpace(formGroup.Name)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formGroup.Name)); } } else { if (!string.IsNullOrWhiteSpace(formGroup.Path)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formGroup.Path)); } } htmlDiv.Hidden.Value = formGroup.IsHidden; if (htmlContainer == null) { html = htmlDiv; } else { htmlContainer.Add(htmlDiv); } foreach (var formItem in formGroup.Contents) { Visit(formItem, htmlDiv); } }
public void BlazorChartTest_CodedStep() { // Refreshing the DOM tree this.ActiveBrowser.RefreshDomTree(); // Loading the chart HtmlDiv chart = this.Find.ByExpression <HtmlDiv>("tagName=div", "class=~k-chart"); // Loading chart's point groups HtmlControl pointsGroup = chart.Find.ByExpression <HtmlControl>("tagName=g", "clip-path=~salesandrevenue#kdef1"); // Finding the points by circle var points = pointsGroup.Find.AllByTagName("circle"); foreach (Element point in points) { // Hovering over the circles HtmlControl pCtrl = point.As <HtmlControl>(); pCtrl.MouseHover(1, 1); System.Threading.Thread.Sleep(1000); // Capturing the image and using OCR to convert image into text data this.ExtractPointData(); this.ActiveBrowser.RefreshDomTree(); System.Threading.Thread.Sleep(1000); } // Logging captured data var dataPoint = this.DataPoints.Where(dp => dp.Category == "Jun").FirstOrDefault(); Log.WriteLine("Category : " + dataPoint.Category); Log.WriteLine("HL : " + dataPoint.AA); Log.WriteLine("ML : " + dataPoint.DM); Log.WriteLine("SF : " + dataPoint.SF); Log.WriteLine("Total : " + dataPoint.TotalRevenue); // Validating if the captured data is matching with the data from the service Assert.IsTrue(new ValidationService().ValidateProductPoints(this.DataPoints)); }
public static void LoginDA_Faileure(string userEmail = "", string userPwd = "") { Logger.log.Info("****** Start LoginDA_Faileure() ********"); if (userEmail == "") { userEmail = ConstantsUtil.defaultUserEmail; } if (userPwd == "") { userPwd = ConstantsUtil.defaultUserPwd; } Logger.log.Debug(" === LoginDA_Faileure uses user email : " + userEmail.ToString()); HtmlEdit credentialsEmailEdit = DesktopAppControls.GetCredentialsEmailEdit(); HtmlEdit credentialsPasswordEdit = DesktopAppControls.GetCredentialsPasswordEdit(); HtmlDiv usernameorPasswordwaPane = new HtmlDiv(DesktopAppControls.GetApplicationHostPane()); usernameorPasswordwaPane.FilterProperties[HtmlDiv.PropertyNames.Class] = "error"; usernameorPasswordwaPane.FilterProperties[HtmlDiv.PropertyNames.ControlDefinition] = "class=\"error\" data-bind=\"html: ErrorMessage\""; usernameorPasswordwaPane.FilterProperties[HtmlDiv.PropertyNames.TagInstance] = "22"; HtmlButton signInButton = DesktopAppControls.GetSignInButton(); // Type email in 'credentials-email' text box credentialsEmailEdit.Text = userEmail; // Type pwd in 'credentials-password' text box credentialsPasswordEdit.Text = userPwd; // Click 'Sign In' button Mouse.Click(signInButton, new Point(218, 21)); Thread.Sleep(5000); Assert.AreEqual("Username or Password was incorrect.", usernameorPasswordwaPane.InnerText, "!!!! INCORRERCT ERROR MESSAGE !!!"); Logger.log.Info("****** End LoginDA_Faileure() ********"); }
/// <summary> /// Verifies the events titles are missing on the page frontend. /// </summary> /// <param name="eventTitles">The event titles.</param> /// <returns>true or false depending on event titles missing on frontend</returns> public bool AreEventTitlesMissingOnThePageFrontend(IEnumerable <string> eventTitles) { if (eventTitles == null && eventTitles.Count() == 0) { throw new ArgumentNullException("eventTitles cannot be empty parameter."); } HtmlDiv frontendPageMainDiv = BAT.Wrappers().Frontend().Pages().PagesWrapperFrontend().GetPageContent(); foreach (var title in eventTitles) { var eventAnchor = frontendPageMainDiv.Find.ByExpression <HtmlAnchor>("tagname=a", "InnerText=" + title); if (eventAnchor != null && eventAnchor.IsVisible()) { return(false); } } return(true); }
/// <summary> /// Creates a div that will contain a number counter. /// </summary> /// <returns>The HTML element of the counter.</returns> private static HtmlDiv CreateCounterDiv() { HtmlDiv elem = new HtmlDiv(); elem.SetStyleAttribute(CssAttribute.Position, "absolute"); elem.SetStyleAttribute(CssAttribute.Display, CssDisplay.Block); elem.Margin.Top = new Unit(4, UnitType.Pixel); elem.Position.Right = 1; elem.Position.Top = 1; elem.Padding.Top = 3; elem.Font.Size = new FontUnit(14, UnitType.Pixel); elem.SetStyleAttribute(CssAttribute.TextAlign, "center"); elem.BorderColor = Color.White; elem.BorderStyle = BorderStyle.Solid; elem.BorderWidth = 1; elem.Width = 29; elem.Height = 23; elem.InnerHtml = String.Empty; return(elem); }
private void ReportReferendums(string electionKey) { var referendums = Referendums.GetElectionReportSummaryData(electionKey); if (referendums.Count == 0) { return; } // ReSharper disable once PossibleNullReferenceException (new HtmlDiv().AddTo(ReportContainer, "category-title referendum-header accordion-header") as HtmlGenericControl).InnerHtml = "Referendums and Ballot Measures"; var container = new HtmlDiv().AddTo(ReportContainer, "category-content referendums-content accordion-content"); foreach (var referendum in referendums) { ReportOneReferendum(container, referendum); } }
public void AfterRegisteringNewUser_AccountSettingsIsShown() { HtmlDiv registerDiv = new HtmlDiv(this.window); registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo); SetFormValues(registerDiv, Guid.NewGuid().ToString("N"), "pass", "pass"); HtmlDiv accountSettingsDiv = new HtmlDiv(window); accountSettingsDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "accountSettingsControl"); Assert.IsTrue(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0); HtmlButton submitRegisterButton = new HtmlButton(registerDiv); Mouse.Click(submitRegisterButton); Assert.IsFalse(accountSettingsDiv.Width == 0 && accountSettingsDiv.Height == 0); }
protected Control FormatCandidatePhone(DataRow candidate) { Control control = new PlaceHolder(); var publicPhone = candidate.PublicPhone(); if (!string.IsNullOrEmpty(publicPhone)) { var div = new HtmlDiv().AddTo(control, "phone"); new HtmlImage { Src = "/images/phone.png" }.AddTo(div); new HtmlSpan { InnerText = FormatPhone(publicPhone) }.AddTo (div); } return(control); }
/// <summary> /// Selects navigation widget display mode in the widget designer /// </summary> /// <param name="mode">Navigation display mode</param> public void SelectNavigationWidgetDisplayMode(string mode) { HtmlDiv optionsDiv = EM.Navigation.NavigationWidgetEditScreen.DislayModeList .AssertIsPresent("Navigation div"); List <HtmlDiv> navDivs = optionsDiv.Find.AllByExpression <HtmlDiv>("tagname=div", "class=radio").ToList <HtmlDiv>(); foreach (var div in navDivs) { if (div.InnerText.Contains(mode)) { HtmlInputRadioButton optionButton = div.Find.ByExpression <HtmlInputRadioButton>("tagname=input", "type=radio"); if (optionButton != null && optionButton.IsVisible()) { optionButton.Click(); } } } }
/// <summary> /// Type a message. /// </summary> /// <param name="message">Message.</param> public void TypeAMessage(string message) { ActiveBrowser.WaitUntilReady(); ActiveBrowser.RefreshDomTree(); ActiveBrowser.WaitForAjax(10000); ActiveBrowser.WaitForAsyncJQueryRequests(); HtmlDiv editable = this.EM.CommentsAndReviews.CommentsFrontend.LeaveACommentArea .AssertIsPresent("Leave area"); editable.ScrollToVisible(); editable.Focus(); editable.MouseClick(); Manager.Current.Desktop.KeyBoard.KeyDown(System.Windows.Forms.Keys.Control); Manager.Current.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.A); Manager.Current.Desktop.KeyBoard.KeyUp(System.Windows.Forms.Keys.Control); Manager.Current.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.Delete); Manager.Current.Desktop.KeyBoard.TypeText(message); }
/// <summary> /// Selects items in form widget selector. /// </summary> /// <param name="itemName">Name of the item.</param> public void SelectItemsInFormWidgetSelector(params string[] itemNames) { HtmlDiv activeTab = this.EM.Selectors.SelectorsScreen.FormSelector.AssertIsPresent("active tab"); foreach (var itemName in itemNames) { var itemsToSelect = activeTab.Find.AllByCustom <HtmlContainerControl>(a => a.InnerText.Equals(itemName)); foreach (var item in itemsToSelect) { if (item.IsVisible()) { item.Wait.ForVisible(); item.ScrollToVisible(); item.MouseClick(); ActiveBrowser.RefreshDomTree(); break; } } } }
private static void AddBioInfo(DataRow candidate, BioInfo bioInfo) { var value = candidate == null ? string.Empty : (candidate[bioInfo.Column] as string).SafeString().Trim(); var item = new HtmlDiv { InnerText = value }.AddTo(bioInfo.Container, "info-item bio-item"); if (value == string.Empty) { item.AddCssClasses("empty-item"); } else { bioInfo.HasValue = true; } }
/// <summary> /// Selects profile widget display mode in the widget designer /// </summary> /// <param name="mode">Profile display mode</param> public void SelectDisplayModeWhenChangesAreSaved(string mode) { HtmlDiv optionsDiv = EM.Identity.ProfileEditScreen.WhenChangesAreSavedDiv .AssertIsPresent("Profile div"); List <HtmlDiv> profileDivs = optionsDiv.Find.AllByExpression <HtmlDiv>("tagname=div", "class=radio").ToList <HtmlDiv>(); foreach (var div in profileDivs) { if (div.InnerText.Contains(mode)) { HtmlInputRadioButton optionButton = div.Find.ByExpression <HtmlInputRadioButton>("tagname=input", "type=radio"); if (optionButton != null && optionButton.IsVisible()) { optionButton.Click(); } } } }
private static void PopulateIncumbentsToAdjustList( IEnumerable <IGrouping <string, DataRow> > incumbentsToEliminate, Control parent) { parent.Controls.Clear(); new HtmlH6 { InnerHtml = "Incumbent(s) must be removed from the following office(s)" + " to make room for newly elected candidate(s).<br />" + "<em>If any incumbents won reelection, remove them here then" + " mark them as winners on the </em>General Winners<em> tab.</em><br />" + "<em>If no incumbents were running for reelection, remove the current" + " office holder whose term is expiring.</em>" }.AddTo(parent); var container = new HtmlDiv().AddTo(parent, "offices"); foreach (var incumbents in incumbentsToEliminate) { var office = incumbents.First(); var div = new HtmlDiv().AddTo(container, "office"); div.Attributes.Add("rel", office.OfficeKey()); new HtmlP { InnerHtml = Offices.FormatOfficeName(office) }.AddTo(div, "office-name"); var extra = office.ElectionPositions() - (office.Incumbents() - incumbents.Count()); new HtmlP { InnerHtml = $"Eliminate {extra}" }.AddTo(div, "office-extra"); foreach (var incumbent in incumbents) { var p = new HtmlP().AddTo(div); new HtmlInputCheckBox { Checked = true, Value = incumbent.PoliticianKey() }.AddTo(p, "incumbent"); new LiteralControl(Politicians.FormatName(incumbent)).AddTo(p); } } }
private static void BuildSubstitutionsOptionsDisplay(BulkEmailPage page) { new HtmlH3 { InnerText = "Substitution Options" }.AddTo( page.SubstitutionOptionsPlaceHolder, "options-display"); foreach (var optionType in Substitutions.OptionTypeInfos) { var cssClass = "type-" + Regex .Replace(optionType.ShortName, "[^a-z0-9]+", "-", RegexOptions.IgnoreCase) .ToLowerInvariant(); var div = new HtmlDiv().AddTo(page.SubstitutionOptionsPlaceHolder, cssClass + " options-display-type rounded-border"); new HtmlH4 { InnerText = optionType.Name }.AddTo(div); new LiteralControl(optionType.HtmlDescription).AddTo(div); } var linkTextDiv = new HtmlDiv().AddTo(page.SubstitutionOptionsPlaceHolder, "type-linktext options-display-type rounded-border"); new HtmlH4 { InnerText = "Literal Link Text" }.AddTo(linkTextDiv); new LiteralControl("Literal link text can be added to any hyperlink (##)" + " substitution. Enclose the text in curly braces ({}) and insert it just before" + " the closing ##. To use an uploaded image, use {Image:<name>} for the link text" + " where <name> is the external name of an uploaded image (without file extension).").AddTo(linkTextDiv); var embeddedKeysDiv = new HtmlDiv().AddTo(page.SubstitutionOptionsPlaceHolder, "type-embeddedkeys options-display-type rounded-border"); new HtmlH4 { InnerText = "Embedded Keys" }.AddTo(embeddedKeysDiv); new LiteralControl("Certain key values (StateCode, CountyCode, LocalKey," + " ElectionKey, OfficeKey and PoliticianKey) that are not directly related to" + " the recipient selection can be embedded in the template. For example" + " <span class=\"escape\">[[</span>OfficeKey=USPresident<span class=\"escape\">]]</span>").AddTo(embeddedKeysDiv); }
public void Visit(HtmlDiv h) { 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.AppendLine(">"); foreach (var c in h.Contents) { Visit(c); } sb.Append(Tabs(h.Depth)); sb.AppendLine(string.Format("</{0}>", h.Tag)); }
/// <summary> /// Checks the field is present. /// </summary> /// <returns>Is success message field contained</returns> private bool CheckFieldIsPresent(string fieldContent, string widgetName) { ActiveBrowser.WaitUntilReady(); ActiveBrowser.RefreshDomTree(); Manager.Current.ActiveBrowser.RefreshDomTree(); var widgetHeader = Manager.Current .ActiveBrowser .Find .ByCustom <HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar") && d.ChildNodes.First().InnerText.Equals(widgetName)) .AssertIsPresent(widgetName); widgetHeader.ScrollToVisible(); HtmlTable elementTable = widgetHeader.Parent <HtmlTableRow>().Parent <HtmlTable>(); HtmlDiv content = elementTable.Find.ByExpression <HtmlDiv>("class=rdContent"); string innerText = content.InnerText; bool result = innerText.Contains(fieldContent); return(result); }
public bool VerifyVmCreated(CreateVmData data) { Log.Information("Click Completed operation button..."); Thread.Sleep(1000 * 15); var completedOp = new HtmlButton(this, By.ClassName("fxs-drawertray-button")); completedOp.Click(); Log.Information("Check the progress box..."); var progressBox = new HtmlDiv(this, By.ClassName("fxs-progressbox-header")); if (progressBox.Text == "Successfully submitted VM request.") { return(true); } else { return(false); } }
public void TestHiddenInput() { HtmlDiv bodyContainerDiv = new HtmlDiv(this.window); bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer"); // no fieldset available HtmlControl fieldset = new HtmlCustom(bodyContainerDiv); fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset"); HtmlEdit hiddenEdit = new HtmlEdit(fieldset); hiddenEdit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "hiddenTextInput"); Assert.IsTrue(hiddenEdit.TryFind(), "Should be able to find the hidden input since it is in the markup."); Point p; Assert.IsFalse(hiddenEdit.TryGetClickablePoint(out p), "Should not be able to click on a hidden input."); }
public void ManipulateTextInput() { HtmlDiv bodyContainerDiv = new HtmlDiv(this.window); bodyContainerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "layoutBodyContainer"); // no fieldset available HtmlControl fieldset = new HtmlCustom(bodyContainerDiv); fieldset.SearchProperties.Add(HtmlControl.PropertyNames.TagName, "fieldset"); Assert.IsTrue(fieldset.TryFind()); HtmlEdit userNameEdit = new HtmlEdit(fieldset); userNameEdit.SearchProperties.Add(HtmlEdit.PropertyNames.Id, "usernameInput"); Assert.IsTrue(string.IsNullOrWhiteSpace(userNameEdit.Text)); userNameEdit.Text = "MyUserName"; Assert.IsTrue(StringComparer.Ordinal.Equals(userNameEdit.Text, "MyUserName")); }
private void BuildTable(IEnumerable <DataRow> unverifiedVideos) { var even = true; foreach (var row in unverifiedVideos) { var tr = new HtmlTableRow().AddTo(BodyPlaceHolder, even ? "even" : "odd"); tr.Attributes.Add("data-key", row.PoliticianKey()); even = !even; var td = new HtmlTableCell().AddTo(tr, "name"); var content = Politicians.FormatName(row) + " [" + row.StateCode() + "]"; new HtmlDiv { InnerText = content }.AddTo(td).Attributes.Add("title", content); td = new HtmlTableCell().AddTo(tr, "video"); var div = new HtmlDiv().AddTo(td); div.Attributes.Add("title", row.YouTubeWebAddress()); new HtmlAnchor { InnerText = row.YouTubeWebAddress().GetYouTubeVideoId(), HRef = NormalizeUrl(row.YouTubeWebAddress()), Target = "view" }.AddTo(div); new HtmlTableCell { InnerHtml = "<div> </div>" }.AddTo(tr, "channel-url"); new HtmlTableCell { InnerHtml = "<div> </div>" }.AddTo(tr, "channel-title"); new HtmlTableCell { InnerHtml = "<div> </div>" }.AddTo(tr, "channel-desc"); new HtmlTableCell { InnerHtml = "<div> </div>" }.AddTo(tr, "url-to-use"); } }
private void CreateOfficeTitle(Control categoryContent, Control officeContent, IList <DataRow> politicians, string officeTitle) { var officeHeading = officeTitle; var officeInfo = politicians[0]; var electionKey = officeInfo.ElectionKey(); var officeKey = officeInfo.OfficeKey(); var officeClass = officeInfo.OfficeClass(); switch (officeInfo.ElectionType()) { case Elections.ElectionTypeUSPresidentialPrimary: case Elections.ElectionTypeStatePresidentialPrimary: case Elections.ElectionTypeStatePrimary: officeHeading += " " + Parties.GetNationalPartyDescription(officeInfo.NationalPartyCode()); //Parties.GetNationalOrStatePartyDescription(officeInfo.PartyKey(), officeInfo.PartyName()); break; } var titleDiv = new HtmlDiv().AddTo(categoryContent, "office-title accordion-header"); new HtmlSpan { InnerText = officeHeading }.AddTo(titleDiv); if (ReportUser == ReportUser.Master) { CreateMasterOfficeLinks(officeContent, officeInfo); } else { //DC ANCs are not anchors because there are too many candidates to compare //and we don't know who is running against who if ((officeInfo.StateCode() != "DC") || (officeClass != OfficeClass.StateHouse)) { CreateCompareOrIntroAnchor(officeContent, politicians, electionKey, officeKey); } } }
public void Slider_DataBinding() { string minimumValue = TestContext.DataRow["MinimumValue"].ToString(); string maximumValue = TestContext.DataRow["MaximumValue"].ToString(); string selectionStart = TestContext.DataRow["SelectionStart"].ToString(); string selectionEnd = TestContext.DataRow["SelectionEnd"].ToString(); string expectedSliderStart = TestContext.DataRow["ExpectedSliderStart"].ToString(); string expectedSliderEnd = TestContext.DataRow["ExpectedSliderEnd"].ToString(); string configuratorId = "ctl00_ConfiguratorPlaceholder_ConfigurationPanel1"; Manager.LaunchNewBrowser(); Manager.ActiveBrowser.Window.Maximize(); ActiveBrowser.NavigateTo("http://demos.telerik.com/aspnet-ajax/slider/examples/clientsideapi/defaultcs.aspx"); HtmlDiv configurator = Find.ByAttributes <HtmlDiv>("class=panel configurator"); //Find.ByAttributes<HtmlDiv>("class=demo-containers").ScrollToVisible(); Manager.ActiveBrowser.ScrollBy(0, 150); Find.ById <HtmlInputText>(configuratorId + "_SmallChangeNtb").MouseClick(); Find.ById <HtmlInputText>(configuratorId + "_SmallChangeNtb").Value = "1"; Find.ById <HtmlInputText>(configuratorId + "_MinValueNtb").MouseClick(); Find.ById <HtmlInputText>(configuratorId + "_MinValueNtb").Value = minimumValue; Find.ById <HtmlInputText>(configuratorId + "_MaxValueNtb").MouseClick(); Find.ById <HtmlInputText>(configuratorId + "_MaxValueNtb").Value = maximumValue; Find.ById <HtmlInputText>(configuratorId + "_SelectionStartNtb").MouseClick(); Find.ById <HtmlInputText>(configuratorId + "_SelectionStartNtb").Value = selectionStart; Find.ById <HtmlInputText>(configuratorId + "_SelectionEndNtb").MouseClick(); Find.ById <HtmlInputText>(configuratorId + "_SelectionEndNtb").Value = selectionEnd; Find.ById <HtmlInputText>(configuratorId + "_SelectionStartNtb").MouseClick(); RadSlider slider = Find.ById <RadSlider>("RadSliderWrapper_ctl00_ContentPlaceholder1_RadSlider1"); Assert.AreEqual(expectedSliderStart, slider.SelectionStart.ToString()); Assert.AreEqual(expectedSliderEnd, slider.SelectionEnd.ToString()); }
internal void Initialize(SecurePage page) { _TabLabel = page.Master.FindMainContentControl("TabMain" + TabName) as HtmlAnchor; _Button = page.Master.FindMainContentControl("Button" + TabName); _DescriptionTag = page.Master.FindMainContentControl("Description" + TabName) as HtmlInputHidden; Debug.Assert(_TabLabel != null, "_TabLabel != null"); var li = _TabLabel.Parent as HtmlGenericControl; var astDiv = new HtmlDiv(); astDiv.Attributes.Add("class", "tab-ast tiptip"); if (TabAsteriskToolTip != null) { astDiv.Attributes.Add("title", TabAsteriskToolTip); } else { astDiv.Attributes.Add("title", "There are unsaved changes on the " + _TabLabel.InnerText + " tab"); } astDiv.AddTo(li); if (_Button != null) { if (ButtonToolTip != null) { _Button.SetToolTip(ButtonToolTip); } else { _Button.SetToolTip("Update " + _TabLabel.InnerText); } } if (_DescriptionTag != null) { _DescriptionTag.Value = _TabLabel.InnerText; } }
public void RegistrationButtonEnabledOnlyWhenFormValid() { HtmlDiv registerDiv = new HtmlDiv(this.window); registerDiv.SearchProperties.Add(HtmlDiv.PropertyNames.Id, "registerControl", PropertyExpressionOperator.EqualTo); HtmlDiv usernamePasswordDiv = new HtmlDiv(registerDiv); HtmlEdit username = new HtmlEdit(usernamePasswordDiv); username.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "username", PropertyExpressionOperator.Contains); username.Text = ""; HtmlEdit password = new HtmlEdit(usernamePasswordDiv); password.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "password", PropertyExpressionOperator.Contains); password.Text = ""; HtmlEdit confirmPassword = new HtmlEdit(registerDiv); confirmPassword.SearchProperties.Add(HtmlEdit.PropertyNames.ControlDefinition, "confirmPassword", PropertyExpressionOperator.Contains); confirmPassword.Text = ""; HtmlButton submitRegisterButton = new HtmlButton(registerDiv); Assert.IsTrue(submitRegisterButton.TryFind()); Assert.IsFalse(submitRegisterButton.Enabled); username.Text = "mike"; Assert.IsFalse(submitRegisterButton.Enabled); password.Text = "password"; Assert.IsFalse(submitRegisterButton.Enabled); confirmPassword.Text = "nomatch"; Assert.IsFalse(submitRegisterButton.Enabled); confirmPassword.Text = "password"; Assert.IsTrue(submitRegisterButton.Enabled); }
public void BuyOneProductCodedUI() { var bw = BrowserWindow.Launch("http://localhost:5001"); HtmlDiv categoryDiv = new HtmlDiv(bw); categoryDiv.SearchProperties.Add(HtmlControl.PropertyNames.Class, "hidden-xs", PropertyExpressionOperator.Contains); HtmlHyperlink lightingCategoryLink = new HtmlHyperlink(categoryDiv); lightingCategoryLink.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Lighting", PropertyExpressionOperator.Contains); Mouse.Click(lightingCategoryLink); HtmlDiv Container = new HtmlDiv(bw); Container.SearchProperties.Add(HtmlControl.PropertyNames.Class, "container", PropertyExpressionOperator.Contains); HtmlHyperlink lightingProduct = new HtmlHyperlink(bw); lightingProduct.SearchProperties.Add(HtmlControl.PropertyNames.Title, "Halogen Headlights", PropertyExpressionOperator.Contains); Mouse.Click(lightingProduct); HtmlHyperlink ProductLink = new HtmlHyperlink(bw); ProductLink.SearchProperties.Add(HtmlControl.PropertyNames.InnerText, "Add to Cart", PropertyExpressionOperator.Contains); Assert.IsTrue(ProductLink.TryFind()); }
HtmlGrid<User> BuildUserGrid (List<User> users){ var grid = new HtmlGrid<User>(){Name="User"}; grid.DataSource= users; grid.Css = new Bootstrap(); grid.AddGridColum( c=> { c.CellRenderFunc=(row,index,dt)=> row.Id; c.HeaderText="Id"; c.Hidden=true; }); grid.AddGridColum( c=> { c.CellRenderFunc= (row,index,dt)=> row.Name; c.HeaderText="Name"; }); grid.AddGridColum( c=> { c.HeaderText="City"; c.CellRenderFunc=(row,index,dt)=> row.City; }); grid.AddGridColum( c=> { c.CellRenderFunc= (row,index,dt)=> row.Address; c.HeaderText="Address"; }); grid.AddGridColum( c=> { c.HeaderText="Birthday"; c.CellRenderFunc=(row,index,dt)=> row.DoB.Format("MM/dd/yyy"); c.CellStyle.TextAlign="center"; }); grid.AddGridColum( c=> { c.HeaderText="E-Mail"; c.CellRenderFunc=(row,index,dt)=> row.Email; }); grid.AddGridColum( c=> { c.HeaderText="Rating"; c.CellRenderFunc=(row,index,dt)=>{ dt.Parent.AddCssClass(row.Rating==10?"success":row.Rating<6?"warning":"" ); return row.Rating; }; c.CellStyle.TextAlign="center"; }); grid.AddGridColum( c=> { c.HeaderText="Level"; c.CellRenderFunc=(row,index,dt)=> { c.CellStyle.Color= row.Level=="A"?"green": row.Level=="B"?"orange":"red"; return row.Level; }; c.CellStyle.TextAlign="center"; }); grid.AddGridColum( c=> { c.HeaderText="Active?"; c.CellRenderFunc=(row,index,dt)=> { dt.Parent.Style.Color=row.IsActive?"black":"grey"; //return row.IsActive.Format(); var itag = new HtmlIcon(){ Class= row.IsActive? "icon-ok-circle":"icon-ban-circle", }; return itag; }; c.CellStyle.TextAlign="center"; }); grid.AddGridColum( c=> { c.HeaderText=""; c.CellStyle.Width=new WidthProperty(){Unit="%",Value=10}; c.CellRenderFunc=(row,index,dt)=>{ var idiv = new HtmlDiv(); var itag = new HtmlIcon(){ Name="User", Class="button-edit icon-edit", Url= "api/User/read/{0}".Fmt( row.Id) }; itag.Style.Margin.Left= 5; idiv.AddHtmlTag(itag); itag = new HtmlIcon(){ Class="button-delete icon-remove", Url= "api/User/destroy/{0}".Fmt( row.Id) }; itag.Style.Margin.Left= 5; itag.Style.Color="red"; idiv.AddHtmlTag(itag); return idiv; }; }); return grid; }
void SendSalesRepoByMail(HtmlDiv div, string mailTarget){ Mailer.Send(message=>{ message.Subject= "Cayita.Widgets - Demo: Sales Repo"; message.From= new MailAddress("*****@*****.**"); message.To.Add(mailTarget); message.Body= div.ToString(); message.IsBodyHtml=true; }); }
/// <summary> /// Gets the div on the screen based on the ID provided /// </summary> internal HtmlDiv SelectDivOnPage(string divId) { HtmlDiv divOnPage = new HtmlDiv(this.UIXeroSalesWindowsInteWindow.UIXeroNewRepeatingInvoDocument); divOnPage.SearchProperties.Add(HtmlDiv.PropertyNames.Id, divId, PropertyExpressionOperator.Contains); return divOnPage; }
/// <summary> /// Drags the widget to the specified dropzone /// </summary> /// <param name="widgetElement">The Widget</param> /// <param name="dropZone">The Dropzone</param> private void AddWidgetToDropZone(HtmlDiv widgetElement, HtmlDiv dropZone) { ActiveBrowser.RefreshDomTree(); widgetElement.Refresh(); widgetElement.DragTo(dropZone); }
HtmlGrid<Author> BuildAuthorGrid (List<Author> users){ var grid = new HtmlGrid<Author>(){Name="Author"}; grid.DataSource= users; grid.Css = new Bootstrap(); grid.AddGridColum( c=> { c.CellRenderFunc=(row,index,dt)=> row.Id; c.HeaderText="Id"; c.Hidden=true; }); grid.AddGridColum( c=> { c.CellRenderFunc= (row,index,dt)=> row.Name; c.HeaderText="Name"; }); grid.AddGridColum( c=> { c.HeaderText="City"; c.CellRenderFunc=(row,index,dt)=> row.City; }); grid.AddGridColum( c=> { c.CellRenderFunc= (row,index,dt)=> row.Comments; c.HeaderText="Comments"; }); grid.AddGridColum( c=> { c.HeaderText="Active?"; c.CellRenderFunc=(row,index,dt)=> { dt.Parent.Style.Color=row.Active?"black":"grey"; var itag = new HtmlIcon(){ Class= row.Active? "icon-ok-circle":"icon-ban-circle", }; return itag; }; c.CellStyle.TextAlign="center"; }); grid.AddGridColum( c=> { c.HeaderText=""; c.CellStyle.Width=new WidthProperty(){Unit="%",Value=10}; c.CellRenderFunc=(row,index,dt)=>{ var idiv = new HtmlDiv(); var itag = new HtmlIcon(){ Name="Author", Class="button-edit icon-edit", Url= "api/Author/read/{0}".Fmt( row.Id) }; itag.Style.Margin.Left=5; idiv.AddHtmlTag(itag); itag = new HtmlIcon(){ Class="button-delete icon-remove", Url= "api/Author/destroy/{0}".Fmt( row.Id) }; itag.Style.Margin.Left=5; itag.Style.Color="red"; idiv.AddHtmlTag(itag); return idiv; }; }); return grid; }
public void DivClick(string id, int num = 1) { HtmlDiv Div = new HtmlDiv(Doc); Div.SearchProperties[HtmlDiv.PropertyNames.Id] = id; for (int i = 0; i < num; i++) { Mouse.Click(Div); } }
public static bool VerifyDivElementPresent() { var div = new HtmlDiv(browserWindow); try { div.SearchProperties.Add(CSVReader.ControlType + ".PropertyNames." + CSVReader.LocatorType, CSVReader.LocatorValue); div.WaitForControlEnabled(10000); div.WaitForControlReady(); } catch (Exception) { Assert.Fail("Failed to find " + CSVReader.ControlType + " Element - Element not Found"); } return div.Enabled; }
private void SelectElementInTree(string itemName, HtmlDiv activeTab) { var element = activeTab.Find.ByExpression<HtmlSpan>("innertext=" + itemName); if (element != null && element.IsVisible()) { element.Click(); ActiveBrowser.RefreshDomTree(); } else { var arrows = this.EM.Widgets.WidgetDesignerContentScreen.Find.AllByCustom<HtmlSpan>(a => a.CssClass.Contains("k-icon k-plus")); Assert.AreNotEqual(0, arrows.Count, "No arrows appear"); this.SearchAndSelectElementByExpandingArrows(arrows, element, itemName, activeTab); this.isHierarchicalItemFound = false; } }
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"); } } } } }
/// <summary> /// Gets the More Link from a widget in the form dropzone /// </summary> /// <param name="widget">The widget to search in.</param> /// <returns>The more link</returns> private HtmlAnchor GetWidgetMoreLink(HtmlDiv widget) { HtmlAnchor morelink = widget.Find.ByExpression<HtmlAnchor>("tagname=a", "innertext=More") .AssertIsPresent("More Link"); return morelink; }
public void DivClick(string id) { HtmlDiv Div = new HtmlDiv(Doc); Div.SearchProperties[HtmlDiv.PropertyNames.Id] = id; Mouse.Click(Div); }
/// <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; }