예제 #1
0
        private List <string> GetDiscussionUrls(IE ie, string siteUrl)
        {
            List <string> discussions = new List <string>();

            ie.GoTo(siteUrl);
            ie.WaitForComplete();

            bool done = false;

            ie.Link(Find.ById("discussionTab")).Click();
            while (!done)
            {
                ie.WaitForComplete();
                foreach (var div in ie.Divs)
                {
                    if (div.ClassName == "post_content")
                    {
                        discussions.Add(div.Link(Find.First()).Url);
                    }
                }

                var pag  = ie.List(Find.ById("discussion_pagination"));
                var link = pag.Link(Find.ByText("Next"));
                if (link.Exists)
                {
                    link.Click();
                }
                else
                {
                    done = true;
                }
            }

            return(discussions);
        }
 private static AttributeConstraint TextCaseInsensitiveConstraint(string text)
 {
     return(Find.ByText(new StringEqualsAndCaseInsensitiveComparer(text)));
 }
 /// <summary>
 /// Returns the <see cref="Options" /> which matches the specified <paramref name="text"/>.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <returns><see cref="Options" /></returns>
 public virtual Option Option(Regex text)
 {
     return(Option(Find.ByText(text)));
 }
        /// <summary>
        /// This method selects an item by text using the supplied regular expression.
        /// Raises NoValueFoundException if the specified value is not found.
        /// </summary>
        /// <param name="regex">The regex.</param>
        public virtual void Select(Regex regex)
        {
            Logger.LogAction("Selecting text using regular expresson '{0}' in {1} '{2}', {3}", regex, GetType().Name, IdOrName, Description);

            SelectByTextOrValue(Find.ByText(regex));
        }
        /// <summary>
        /// This method selects an item by text using the supplied regular expression.
        /// Raises NoValueFoundException if the specified value is not found.
        /// </summary>
        /// <param name="regex">The regex.</param>
        public void Select(Regex regex)
        {
            Logger.LogAction("Selecting text using regular expresson '" + regex.ToString() + "' in " + GetType().Name + " '" + Id + "'");

            SelectByTextOrValue(Find.ByText(regex));
        }