htmlagilitypack

Using BrowserSession and HtmlAgilityPack to login to Facebook through .NET

Hello, I'm trying to use Rohit Agarwal's BrowserSession class together with HtmlAgilityPack to login to and subsequently navigate around Facebook. I've previously managed doing the same by writing my own HttpWebRequest's. However, it then only works when I manually fetch the cookie from my browser and insert a fresh cookie-string to the...

XPath problem, getting "expression must evaluate to a node-set." error..

I'm having trouble retrieving a single node by its explicit XPath that I have already found by other ways. I have node and I can get its XPath, but when I try to retrieve that same node again this time via node.XPath it gives the "expression must evaluate to a node-set" error. Shouldn't this work? I'm using HtmlAgilityPack in C# btw f...

Use HtmlAgilityPack to divy up a document

I'm wondering if this is possible. I have html like so: <p> <font face="Georgia"> <b>History</b><br>&nbsp; <br>Two of the polysaccharides used in the manufacture of...</font> <a title="PubMed" href="http://www.www.gov/pubmed/" target="_blank"> <font face="Georgia">) and this web site for new development by...well as Self ...

HTMLNode.Name containing pound sign in HtmlAgilityPack?

I have code using the Html Agility Pack. There is a line that compares the name of an HTML node to a string containing a pound sign. Does that make sense? HtmlAgilityPack.HtmlNode node; ... if (node.Name == "#text") ... ...

Select elements added to the DOM by a script

Hi, I've been trying to get either an <object> or an <embed> tag using: HtmlNode videoObjectNode = doc.DocumentNode.SelectSingleNode("//object"); HtmlNode videoEmbedNode = doc.DocumentNode.SelectSingleNode("//embed"); This doesn't seem to work. Can anyone please tell me how to get these tags and their InnerHtml? A YouTube embedded ...

how to load text as html using Html Agility Pack

Hi All, I have a text like: <table class="\"matches \"> <thead> <tr class="\"sub-head\"> <th class="\"day\"> Day<\/th><th class="\"date\"> Date<\/th><th class="\"team team-a\"> Home team<\/th><th class="\"score-time\"> Scor...

How to get count number of SelectedNode with XPath in C#?

Hi, I am using HTMLAgilityPack in my application, and i want to get the item(node) count of SelectedNodes as the code below: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(webBrowser1.DocumentText); var tagListe = doc.DocumentNode.SelectNodes("//a[@href]"); var divListe = doc.DocumentNode.SelectNodes...

how to load text as html using Html Agility Pack

<table class="\"matches \"> <thead> <tr class="\"sub-head\"> <th class="\"day\"> Day<\/th><th class="\"date\"> Date<\/th><th class="\"team team-a\"> Home team<\/th><th class="\"score-time\"> Score\/Time<\/th><th class="\"team team-b\"> ...

XPath syntax to extract URL from HTMLNode using HTMLAgilityPack?

What is the proper XPath syntax to grab the value of the href attribute from the following HTMLNode: <a target="_blank" class="monkeys" href="http://someurl.com" id="123"> <span class="title">Monkeys are flying all over!</span> </a> ...

XPath Expression not working in HtmlAgilityPack!

Hi all, I know it may be of my noobness in XPath, but let me ask to make sure, cuz I've googled enough. I have a website and wanna get the news headings from it: www.farsnews.com (it is Persian) Using FireBug and FireXpath extensions under firefox and by hand I extract and test multiple Xpath expressions that matches the headings, suc...

HTML Parsing, iterating over a Dictionary<>, no results returning when expected. C#

Working with HTML Agility Pack in C#. Running the following code on a site I know should return some values keeps coming up blank. Can anyone see what I'm doing wrong here? public Dictionary<string, string> linkMiner(string site) { Dictionary<string, string> links = new Dictionary<string, string>(); url = site; ...

Alternatives to HtmlAgilityPack?

HtmlAgilityPack kind of sucks IMO. They made some really wonky design decisions. When using SelectNodes, if no nodes are found, it returns null rather than an empty set, so you can't just foreach over it without a null check. When trying to select children with node.SelectNodes it actually searches from the document root (which I thoug...

Remove linebreak node in htmlagilitypack?

Hi guys, im trying to retrieve this text on a webpage without the line break: <span class="listingTitle">888-I-AM-JUNK. Canada's most trusted BIG LOAD junk removal<br />specialist!</span></a> How can I do it? Here is my current code so far, im using vb. Dim content As String = "" Dim doc As New HtmlAgilityPack.HtmlDocument()...

Help with HtmlAgilityPack, match 2 different nodes with each other.

Im a little stuck with my app again. My app retrieves "Place names" and their "Addresses" from yellowpages.ca Here is the code so far: Dim content As String = "" Dim web As New HtmlAgilityPack.HtmlWeb Dim doc As New HtmlAgilityPack.HtmlDocument() doc.Load(WebBrowser1.DocumentStream) Dim hnc As HtmlAgilityPack.HtmlN...

Delete lines in richtextbox that fall under the condition

Using this link http://www.yellowpages.ca/search/?stype=si&amp;what=sh&amp;where=Ottawa,+ON&amp;x=0&amp;y=0 and telling HtmlAgilityPack to retrieve both address and place name at the same time ("//span[@class='listingTitle']|//div[@class='address']/text()[normalize-space(.)]"), I can get a list of placenames and addresses like this in a ...

Xpath preceding-sibling (using HtmlAgilityPack and VB)

Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents. I need help selecting the preceding-sibling of div class="address" in this url: www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON The sibling that I want is h3 class="listingTitleLine" Here is a screenshot: http://i55.tinypic.com/25gc4qo.png Can I get some help ...

HtmlAgilityPack interfering with my code (not a HtmlAgilityPack question)

Here is a snip of my code: Dim content As String = "" Dim web As New HtmlAgilityPack.HtmlWeb Dim doc As New HtmlAgilityPack.HtmlDocument() doc.Load(WebBrowser1.DocumentStream) Dim hnc As HtmlAgilityPack.HtmlNodeCollection = doc.DocumentNode.SelectNodes("//div[@class='address']/preceding-sibling::h3[@class='listingTitleL...

Getting started with HtmlAgilityPack

I'm trying to get started with HtmlAgilityPack and was wondering if someone could help me get off to a good start. I'm trying to access the user1 id and the password1 id from the url https://www.foragentsonly.com/login.aspx How would I go about that? ...

Get links from webpage to textbox (vb.net + html agility pack)

Im making a vb.net app and im using htmlagilitypack. I need hap to get the profile links from yellowpages.ca Here is an example of the html: <a href="/bus/Ontario/Brampton/A-Safe-Self-Storage/17142.html?what=af&amp;where=Ontario&amp;le=1238793c7aa%7Ccf8042ceaa%7C2ae32e5a2a" onmousedown="utag.link({link_name:'busname', link_attr1:'in_li...

Using htmlagility xpath's to find webdriver elements

I'm using htmlagility pack to locate elements in large loops through tables because its much faster than using the native methods provided through webdriver. After locating a specific element through the looping I'm getting its xpath, then feeding that to webdriver to return an element. However I'm getting an exception; OpenQA.Sel...