/// <summary> /// Selects "an extra option" (option from the 'More' menu) /// for a given widget /// </summary> /// <param name="extraOption">The option to be clicked</param> /// <param name="dropZoneIndex">The dropZone(location) of the widget</param> public void SelectExtraOptionForWidget(string extraOption, int dropZoneIndex = 0) { ActiveBrowser.WaitForAsyncOperations(); Manager.Current.ActiveBrowser.RefreshDomTree(); var widgetHeader = Manager.Current .ActiveBrowser .Find .AllByCustom <HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar"))[dropZoneIndex] .AssertIsPresent("Widget at position: " + dropZoneIndex); widgetHeader.ScrollToVisible(); HtmlAnchor moreLink = widgetHeader.Find .ByCustom <HtmlAnchor>(a => a.TagName == "a" && a.Title.Equals("More")) .AssertIsPresent("more link"); moreLink.Focus(); moreLink.Click(); ActiveBrowser.WaitForAsyncOperations(); Manager.Current.ActiveBrowser.RefreshDomTree(); HtmlDiv menuDiv = ActiveBrowser.Find .ByExpression <HtmlDiv>("tagName=div", "id=RadContextMenu1_detached") .AssertIsPresent <HtmlDiv>("More options menu"); menuDiv.Find .ByCustom <HtmlSpan>(x => x.InnerText.Contains(extraOption)) .AssertIsPresent <HtmlSpan>("option " + extraOption) .Click(); }
/// <summary> /// Sets the page title. /// </summary> /// <param name="pageName">Name of the page.</param> public void SetPageTitle(string pageName) { if (string.IsNullOrEmpty(pageName)) { throw new ArgumentNullException("pageName cannot be empty value."); } Manager.Current.ActiveBrowser.RefreshDomTree(); var frame = Manager.Current.ActiveBrowser.WaitForFrame(new FrameInfo() { Name = "create" }); HtmlInputText pageNameInput = frame.Find.ByExpression <HtmlInputText>("tagname=input", "class=sfTxt", "name=contentViewInsertDialog$ctl00$ctl00$contentView$frontendPagesCreate$ctl00$ctl00$sections$ctl00$mainSection$ctl00$ctl00$fields$ctl04$UrlNameFieldControl$ctl00$ctl00$textBox_write"); pageNameInput.Focus(); Manager.Current.Desktop.KeyBoard.TypeText(pageName); Manager.Current.ActiveBrowser.RefreshDomTree(); HtmlAnchor changeButton = frame.Find.ByExpression <HtmlAnchor>("tagname=a", "class=sfLinkBtn sfChange", "id=~_UrlNameFieldControl_", "id=~_changeButton_write_"); changeButton.Focus(); changeButton.MouseClick(); Manager.Current.ActiveBrowser.RefreshDomTree(); HtmlInputText changeUrl = frame.Find.ByExpression <HtmlInputText>("tagname=input", "id=~_UrlNameFieldControl_", "id=~_textBox_write"); changeUrl.Focus(); Manager.Current.Desktop.KeyBoard.TypeText(pageName.ToLower()); }
/// <summary> /// Edit widget by name /// </summary> /// <param name="widgetName">The widget name</param> /// <param name="dropZoneIndex">The drop zone index</param> public void EditWidget(string widgetName, int dropZoneIndex = 0, bool isMediaWidgetEdited = false) { ActiveBrowser.WaitUntilReady(); ActiveBrowser.RefreshDomTree(); ActiveBrowser.WaitUntilReady(); var widgetHeader = ActiveBrowser .Find .AllByCustom <HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar") && d.ChildNodes.First().InnerText.Equals(widgetName))[dropZoneIndex] .AssertIsPresent(widgetName); widgetHeader.ScrollToVisible(); HtmlAnchor editLink = widgetHeader.Find .ByCustom <HtmlAnchor>(a => a.TagName == "a" && a.Title.Equals("Edit")) .AssertIsPresent("edit link"); editLink.Focus(); editLink.Click(); ActiveBrowser.WaitUntilReady(); ActiveBrowser.WaitForAsyncOperations(); ActiveBrowser.WaitForAjax(TimeOut); ActiveBrowser.RefreshDomTree(); if (!isMediaWidgetEdited) { HtmlFindExpression expression = new HtmlFindExpression("class=modal-title", "InnerText=" + widgetName); ActiveBrowser.WaitForElement(expression, TimeOut, false); Manager.Current.Wait.For(this.WaitForSaveButton, TimeOut); } }
/// <summary> /// Selects more options in the widget designer /// </summary> public void MoreOptions() { HtmlAnchor moreOptions = EM.Navigation.NavigationWidgetEditScreen.MoreOptions .AssertIsPresent("Css class"); moreOptions.ScrollToVisible(); moreOptions.Focus(); moreOptions.MouseClick(); }
/// <summary> /// Selects more options in the widget designer /// </summary> public void MoreOptions() { HtmlAnchor moreOptions = EM.ScriptsAndStyles.ScriptsAndStylesEditScreen.MoreOptions .AssertIsPresent("More options"); moreOptions.ScrollToVisible(); moreOptions.Focus(); moreOptions.MouseClick(); }
/// <summary> /// Selects expander in the widget designer /// </summary> /// <param name="title">The title.</param> public void ExpandOptions(string title) { HtmlAnchor expander = EM.Widgets.FeatherWidget.Get <HtmlAnchor>("class=Options-toggler ng-binding", "innerText={0}".Arrange(title)).AssertIsPresent("{0} span".Arrange(title)); expander.ScrollToVisible(); expander.Focus(); expander.MouseClick(); ActiveBrowser.RefreshDomTree(); expander.Refresh(); }
/// <summary> /// Selects the link text in editable area. /// </summary> /// <param name="text">The text.</param> public void SelectLinkInEditableArea(string linkText) { Browser frame = this.GetContentBlockFrame(); HtmlAnchor content = frame.Find.ByExpression <HtmlAnchor>("tagName=a", "InnerText=" + linkText); Rectangle contentRect = content.GetRectangle(); Point startPoint = new Point(contentRect.X, contentRect.Y); Point endPoint = new Point(contentRect.X + contentRect.Width, contentRect.Y + contentRect.Height); content.Focus(); content.MouseClick(); ActiveBrowser.Manager.Desktop.Mouse.DragDrop(startPoint, endPoint); }
/// <summary> /// Open month view in Calendar Selector /// </summary> public void OpenMonthViewInCalendarSelector(int targetDay = 15) { HtmlTable daysTable = EM.Events.EventsFrontend.DaysInMonthTableCalendarSelector; daysTable.AssertIsPresent("Day table"); HtmlTableCell day = daysTable.Find.ByExpression <HtmlTableCell>("InnerText=" + targetDay); day.AssertIsPresent("Day"); HtmlAnchor monthLink = day.Find.AllByTagName <HtmlAnchor>("a").First(); monthLink.AssertIsPresent("Day link"); monthLink.Focus(); monthLink.Click(); }
/// <summary> /// Select month in Calendar Selector /// </summary> /// <param name="monthName">Month name</param> public void SelectMonthInCalendarSelector(string monthName) { HtmlTable monthsTable = EM.Events.EventsFrontend.MonthsTableCalendarSelector; monthsTable.AssertIsPresent("Month table"); HtmlTableCell month = monthsTable.Find.ByExpression <HtmlTableCell>("InnerText=" + monthName); month.AssertIsPresent("Month"); HtmlAnchor monthLink = month.Find.AllByTagName <HtmlAnchor>("a").First(); monthLink.AssertIsPresent("Month link"); monthLink.Focus(); monthLink.Click(); }
/// <summary> /// Click on Card widget page /// </summary> public void ClickOnCardWidgetPageFromFrontend(string labelName) { HtmlDiv frontendPageMainDiv = BAT.Wrappers().Frontend().Pages().PagesWrapperFrontend().GetPageContent(); HtmlAnchor pageAnchor = frontendPageMainDiv.Find .ByExpression <HtmlAnchor>("tagname=a", "InnerText=" + labelName) .AssertIsPresent("Tag with this title was not found"); pageAnchor.Focus(); pageAnchor.Click(); ActiveBrowser.WaitUntilReady(); ActiveBrowser.RefreshDomTree(); }
/// <summary> /// Clicks edit link for a selected widget. /// </summary> /// <param name="widgetName">The widget name.</param> /// <param name="dropZoneIndex">The drop zone index.</param> public void EditWidget(string widgetName, int dropZoneIndex = 0) { ActiveBrowser.RefreshDomTree(); var widgetHeader = ActiveBrowser .Find .AllByCustom <HtmlDiv>(d => d.CssClass.StartsWith("rdTitleBar") && d.ChildNodes.First().InnerText.Equals(widgetName))[dropZoneIndex] .AssertIsPresent(widgetName); widgetHeader.ScrollToVisible(); HtmlAnchor editLink = widgetHeader.Find .ByCustom <HtmlAnchor>(a => a.TagName == "a" && a.Title.Equals("Edit")) .AssertIsPresent("edit link"); editLink.Focus(); editLink.Click(); ActiveBrowser.WaitUntilReady(); ActiveBrowser.WaitForAsyncOperations(); ActiveBrowser.RefreshDomTree(); }