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 Discussion GetDiscussion(IE ie, string url) { var disc = new Discussion(); ie.GoTo(url); ie.WaitForComplete(); var hDiv = ie.Div(Find.ByClass("ViewThread")); var h = hDiv.Elements.First(); disc.Title = h.InnerHtml.Replace("\n", "").Trim(); var tDiv = ie.Div(Find.ByClass("Posts")); foreach (var tr in tDiv.TableRows) { if (tr.Id == "PostPanel") { var p = new Post(); var details = tr.TableCells[0]; p.From = details.Div(Find.ByClass("UserName")).Elements.First().InnerHtml; p.When = details.Span(Find.ByClass("smartDate")).Title; var content = tr.TableCells[1]; p.Html = content.InnerHtml; disc.Posts.Add(p); } } return(disc); }
public OptionCollection Filter(Predicate <Option> predicate) { return(new OptionCollection(domContainer, DoFilter(Find.ByElement(predicate)))); }
public TableBodyCollection Filter(Predicate <TableBody> predicate) { return(new TableBodyCollection(domContainer, DoFilter(Find.ByElement(predicate)))); }
/// <summary> /// Finds a list item within the list itself (excluding content from any lists that /// might be nested within it). /// </summary> /// <param name="elementId">The element id regular expression</param> /// <returns>The list item</returns> public virtual ListItem OwnListItem(Regex elementId) { return(OwnListItem(Find.ById(elementId))); }
/// <summary> /// Finds a list item within the list itself (excluding content from any lists that /// might be nested within it). /// </summary> /// <param name="predicate">The predicate</param> /// <returns>The list item</returns> public virtual ListItem OwnListItem(Predicate <ListItem> predicate) { return(OwnListItem(Find.ByElement(predicate))); }
public TableCell TableCell(Regex elementId, int index) { return(TableCell(Find.ById(elementId) & Find.ByIndex(index))); }
/// <summary> /// Finds a list item within the list itself (excluding content from any lists that /// might be nested within it). /// </summary> /// <param name="elementId">The element id</param> /// <returns>The list item</returns> public virtual ListItem OwnListItem(string elementId) { return(OwnListItem(Find.ById(elementId))); }
/// <inheritdoc /> public virtual bool Exists(Regex elementId) { return(Exists(Find.ByDefault(elementId))); }
public ElementCollection Filter(Predicate <Element> predicate) { return(new ElementCollection(domContainer, DoFilter(Find.ByElement(predicate)))); }
private static AttributeConstraint TextCaseInsensitiveConstraint(string text) { return(Find.ByText(new StringEqualsAndCaseInsensitiveComparer(text))); }
/// <summary> /// Returns the <see cref="Options" /> which matches the specified expression. /// </summary> /// <param name="predicate">The expression to use.</param> /// <returns></returns> public virtual Option Option(Predicate <Option> predicate) { return(Option(Find.ByElement((predicate)))); }
/// <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> /// Selects an item in a select box by value using the supplied regular expression. /// Raises NoValueFoundException if the specified value is not found. /// </summary> /// <param name="regex">The regex.</param> public virtual void SelectByValue(Regex regex) { Logger.LogAction("Selecting text using regular expresson '" + regex + "' in " + GetType().Name + " '" + Id + "'"); SelectByTextOrValue(Find.ByValue(regex)); }
/// <summary> /// Selects an item in a select box, by value. /// Raises NoValueFoundException if the specified value is not found. /// </summary> /// <param name="value">The value.</param> public virtual void SelectByValue(string value) { Logger.LogAction("Selecting item with value '" + value + "' in " + GetType().Name + " '" + Id + "'"); SelectByTextOrValue(Find.ByValue(new StringEqualsAndCaseInsensitiveComparer(value))); }