/// <summary>Select all options by the text displayed.</summary>
        /// <param name="text">The text of the option to be selected. If an exact match is not found,
        ///     this method will perform a substring match.</param>
        /// <remarks>When given "Bar" this method would select an option like:
        /// <para>
        ///         &lt;option value="foo"&gt;Bar&lt;/option&gt;</para>
        /// </remarks>
        public void SelectByText(string text, FindOperator oOperator)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text", "text must not be null");
            }

            if (TestSettings.Instance.Browser != TestFramework.Browser.BrowserType.FireFox)
            {
                this.Click();
            }

            if (oOperator == FindOperator.Equals)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText == text))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }

            if (oOperator == FindOperator.Contains)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText.Contains(text)))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }

            if (oOperator == FindOperator.StartsWith)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText.StartsWith(text)))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }
        }
示例#2
0
            public override void VisitFindOperator(FindOperator node)
            {
                base.VisitFindOperator(node);

                if (node.InClause == null || _position >= node.InClause.End)
                {
                    _binder._rowScope = _binder.GetFindColumnsTable(node);
                }
            }
示例#3
0
 /// <summary>The find all by id.</summary>
 /// <param name="id">The id.</param>
 /// <param name="findOperator">The find operator.</param>
 /// <typeparam name="T">The type of HtmlControl.</typeparam>
 /// <returns>The <see cref="IEnumerable{T}"/>.</returns>
 public IEnumerable <T> FindAllById <T>(string id, FindOperator findOperator) where T : HtmlControl, new()
 {
     return(this.Browser.FindAllById <T>(id, findOperator));
 }
示例#4
0
 public T FindByInnerText <T>(string innerText, FindOperator findOperator = FindOperator.Equals) where T : HtmlControl, new()
 {
     return(this.Browser.FindByInnerText <T>(innerText, findOperator));
 }
        /// <summary>Select all options by the text displayed.</summary>
        /// <param name="text">The text of the option to be selected. If an exact match is not found,
        ///     this method will perform a substring match.</param>
        /// <remarks>When given "Bar" this method would select an option like:
        /// <para>
        ///         &lt;option value="foo"&gt;Bar&lt;/option&gt;</para>
        /// </remarks>
        public void SelectByText(string text, FindOperator oOperator)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text", "text must not be null");
            }

            if (TestSettings.Instance.Browser != TestFramework.Browser.BrowserType.FireFox)
            {
                this.Click();
            }

            if (oOperator == FindOperator.Equals)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText == text))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }

            if (oOperator == FindOperator.Contains)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText.Contains(text)))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }

            if (oOperator == FindOperator.StartsWith)
            {
                foreach (HtmlOption option in this.Options.Where(option => option.InnerText.StartsWith(text)))
                {
                    if (!option.Selected)
                    {
                        option.Click();
                    }

                    if (this.Multiple != null && this.Multiple != "true")
                    {
                        return;
                    }
                }
            }
        }
 /// <summary>The find by id.</summary>
 /// <param name="id">The id.</param>
 /// <param name="findOperator">The find Operator.</param>
 /// <typeparam name="T">The type of HtmlControl.</typeparam>
 /// <returns>The <see cref="T"/>.</returns>
 public T FindById <T>(string id, FindOperator findOperator = FindOperator.Equals) where T : HtmlControl, new()
 {
     return(this.Browser.FindById <T>(id, findOperator, this));
 }
 /// <summary>The find all by inner text.</summary>
 /// <param name="innerText">The inner text.</param>
 /// <param name="findOperator">The find operator.</param>
 /// <typeparam name="T">The type of HtmlControl.</typeparam>
 /// <returns>The <see cref="IEnumerable{T}"/>.</returns>
 public IEnumerable <T> FindAllByInnerText <T>(string innerText, FindOperator findOperator = FindOperator.Equals)
     where T : HtmlControl, new()
 {
     return(this.Browser.FindAllByInnerText <T>(innerText, findOperator, this));
 }
示例#8
0
 /// <summary>The switch window.</summary>
 /// <param name="windowName">The window name.</param>
 /// <param name="findOperator">The find operator.</param>
 public abstract void SwitchWindow(string windowName = "", FindOperator findOperator = FindOperator.Equals);
示例#9
0
 /// <summary>The find by inner text.</summary>
 /// <param name="innerText">The inner text.</param>
 /// <param name="findOperator">The find operator.</param>
 /// <param name="containingControl">The containing Control.</param>
 /// <typeparam name="T">The type of HtmlControl.</typeparam>
 /// <returns>The <see cref="T"/>.</returns>
 public abstract T FindByInnerText <T>(
     string innerText, FindOperator findOperator = FindOperator.Equals, HtmlControl containingControl = null)
     where T : HtmlControl, new();
示例#10
0
 /// <summary>The find all by id.</summary>
 /// <param name="id">The id.</param>
 /// <param name="findOperator">The find operator.</param>
 /// <param name="containingControl">The containing Control.</param>
 /// <typeparam name="T">The type of HtmlControl.</typeparam>
 /// <returns>The <see cref="IEnumerable{T}"/>.</returns>
 public abstract IEnumerable <T> FindAllById <T>(
     string id, FindOperator findOperator = FindOperator.Equals, HtmlControl containingControl = null) where T : HtmlControl, new();
示例#11
0
 public override T VisitFindOperator(FindOperator node)
 {
     throw new NotImplementedException();
 }