Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public void SetHtml(Html html)
 {
     _html = html;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Get html content of page
 /// </summary>
 /// <returns></returns>
 public Html GetHtml()
 {
     return _html ?? (_html = new Html(_rawText, _request.Url));
 }
Exemplo n.º 5
0
 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");
 }