public void TestRegexSelector() { Html selectable = new Html("aaaaaaab",""); // Assert.assertEquals("abbabbab", (selectable.regex("(.*)").replace("aa(a)", "$1bb").toString())); string value = selectable.Regex("(.*)").Replace("aa(a)", "$1bb").ToString(); Assert.AreEqual("abbabbab", value); }
public void TestChain() { Html selectable = new Html(_html,""); IList<string> linksWithoutChain = selectable.Links().GetAll(); ISelectable xpath = selectable.XPath("//div"); IList<string> linksWithChainFirstCall = xpath.Links().GetAll(); IList<string> linksWithChainSecondCall = xpath.Links().GetAll(); Assert.AreEqual(linksWithoutChain.Count, linksWithChainFirstCall.Count); Assert.AreEqual(linksWithChainFirstCall.Count, linksWithChainSecondCall.Count); }
public void SetHtml(Html html) { _html = html; }
/// <summary> /// Get html content of page /// </summary> /// <returns></returns> public Html GetHtml() { return _html ?? (_html = new Html(_rawText, _request.Url)); }
public void TestNodes() { Html selectable = new Html(_html,""); IList<ISelectable> links = selectable.XPath("//a").Nodes(); Assert.AreEqual(links[0].Links().Value, "http://whatever.com/aaa"); }