Exemplo n.º 1
0
        public static void Click(this Browser browser, string controlId)
        {
            var element = browser.Link(Find.ById(controlId)) as Element;

            if (!element.Exists)
            {
                element = browser.Link(Find.ByText(t => t.Contains(controlId))) as Element;
                if (!element.Exists)
                {
                    element = browser.Button(Find.ById(controlId));
                    if (!element.Exists)
                    {
                        element = browser.Button(Find.ByValue(t => t.Contains(controlId)));
                        if (!element.Exists)
                        {
                            throw new InvalidOperationException(string.Format("Could not find {0} link on the page",
                                                                              controlId));
                        }
                    }
                }
            }

            element.Click();
        }
        public static void Click(this Browser browser, string controlId)
        {
            var element = browser.Link(l => l.Id == controlId || 
                                      (l.Text != null && l.Text.Contains(controlId))) as Element;

            if (!element.Exists)
            {
                element = browser.Button(b => b.Id == controlId || 
                                        (b.Value != null && b.Value.Contains(controlId)) || 
                                        (b.OuterText != null && b.OuterText.Contains(controlId)));
                if (!element.Exists)
                {
                    throw new InvalidOperationException(string.Format("Could not find '{0}' link on the page", controlId));
                }
            }

            element.Click();
        }
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod, object htmlAttributes) {
     return helper.Button(name, buttonText, buttonType, onClickMethod, new RouteValueDictionary(htmlAttributes));
 }
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod) {
     return helper.Button(name, buttonText, buttonType, onClickMethod, (IDictionary<string, object>)null);
 }
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="helper">The helper which we extend.</param>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType, string onClickMethod, object htmlAttributes)
 {
     return helper.Button(name, buttonText, buttonType, onClickMethod, HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
 public static void ClickButton(this Browser browser, string buttontext)
 {
     browser.Button(x => x.Text == buttontext).Click();
 }
Exemplo n.º 7
0
 public static ButtonBuilder Button(this BootstrapFactory factory, string title)
 {
     return factory.Button().Title(title);
 }
Exemplo n.º 8
0
 public static string Button(this FormHelper helper, System.String value, System.Object attributes)
 {
     return helper.Button(value, new ModelDictionary(attributes));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Button
 /// </summary>
 /// <param name="helper">Helper</param>
 /// <param name="text">Text</param>
 /// <param name="title">Title</param>
 /// <returns>Button</returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string text, string title)
 {
     return helper.Button(text, title, null);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Button
 /// </summary>
 /// <param name="helper">Helper</param>
 /// <param name="text">Text</param>
 /// <param name="htmlAttributes">Html attributes</param>
 /// <returns>Button</returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string text, object htmlAttributes)
 {
     return helper.Button(text, null, htmlAttributes);
 }
Exemplo n.º 11
0
 /// <summary>
 /// A Simple button you can use with javascript
 /// </summary>
 /// <param name="name">Name of the button</param>
 /// <param name="buttonText">The text for the button face</param>
 /// <param name="buttonType">The button type (Button, Submit, or Reset)</param>
 /// <param name="onClickMethod">The method or script routine to call when the button is clicked.</param>
 /// <param name="htmlAttributes">Any attributes you want set on the tag. Use anonymous-type declaration for this: new{class=cssclass}</param>
 /// <returns></returns>
 public static string Button(this HtmlHelper helper, string name, string buttonText, HtmlButtonType buttonType) {
     return helper.Button(name, buttonText, buttonType, null, (IDictionary<string, object>)null);
 }
 public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag, string text)
 {
     return html.Button(text, tag, new { @class = "close", data_dismiss = "alert" });
 }
 public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag)
 {
     return html.Button(DefaultCloseSymbol, tag, new { @class = "close", data_dismiss = "alert" });
 }
Exemplo n.º 14
0
 public static ButtonWrapper ButtonWithVisibleText(this Browser browser, [NotNull] string text)
 {
     const string buttonWithLabel = "button with visible text '{0}'";
     return new ButtonWrapper(browser.Button(Find.ByValue(text).Or(Find.ByText(text))), String.Format(buttonWithLabel, text));
 }
Exemplo n.º 15
0
 public static IHtmlString DefaultButton(this HtmlHelper html, string caption, IDictionary<string, object> htmlAttributes)
 {
     var builder = html.Button(caption, htmlAttributes);
     builder.AddCssClass("btn-default");
     return builder.ToString(TagRenderMode.Normal).AsHtmlString();
 }
		/// <summary>
		/// Sprawdza, czy nad danym przyciskiem został puszczony LPM.
		/// </summary>
		/// <param name="container">this</param>
		/// <param name="id">Identyfikator.</param>
		/// <returns></returns>
		public static bool Button(this IContainer container, string id)
		{
			return container.Button(id, MouseButton.LastButton);
		}