HTML Agility Pack with Full xpath - html-agility-pack

I am trying to find a tool to capture items from web pages. First i have used xpath finder Firefox addon but sometimes it generated xpath with schemas (xpath 2.0) so it is not suitable
Below is the absolute xpath generated with firepath (firefox) for googles search button
html/body/div[2]/div[1]/div[1]/div[2]/div[2]/div/form/div[1]/button[1]
when i try to
doc.DocumentNode.SelectSingleNode("html/body/div[2]/div[1]/div[1]/div[2]/div[2]/div/form/div[1]/button[1]").InnerText;
it gives null reference exception.
So i cant use firepath too.
I need a tool which works with the HTML Agility Pack. Or need to find out why above does not work.

While using FirePath, I got good results when I disabled generating absolute XPATH.
In your case the xpath generated is
.//*[#id='gbqfb']
But I can write a XPATH query something like below:
//button[#name='btnG']
Not sure why your XPATH query is not working but below seems to work when I removed form tag.
doc.DocumentNode.SelectSingleNode("html/body/div[2]/div[1]/div[1]/div[2]/div[2]/div/div[1]/button[1]").InnerText;

Related

HTML highlighting in ATOM dysfunctional when using ZURB Foundation Template Engine Syntax

Im new to ZURB Foundation 6 and its Foundation CLI. Using the template engine works like a charm though, except for the syntax highlighting so far.
Here is a screenshot:
https://imgur.com/P1MCv3X
As you can see, highlighting the beginning and end of an HTML Element doesnt work anymore when Im using the template engine syntax with the double brackets. The site works perfectly, so this erroneous interpretation of the HTML structure is a problem of the editor.
Is there any way to work around this issue in ATOM? Or do I have to live with it?
When you're using a templating engine such as Handlebars (which ZURB seems to use), you need to install a language syntax for that. There are several available, you need to find out for yourself which one works best for you.
Once installed, you either need to work with .hbs files for automatic detection, or you have to specify the syntax manually by clicking on the dialog that reads "HTML" on your screenshot (in the bottom right).

In Firefox xpath not showing detail (relative) xpath for any element

Firefox not showing relative xpath for any element. I am using Firefox version 56.0(32 bit)
There has a problem with the latest version of Firefox(56.0).You need to downgrade your firefox for the version to solve this.Alternatively, you can use chrome to verify XPath
You can copy xpath:
You can open a Console in Chrome, and check the XPath by typing $x("your_xpath_here"). This will return an array of matched values. If it is empty, you know there is no match on the page.
For example:
The Firefox DevTools copy the absolute XPath when you right-click an element within the Inspector and choose Copy > XPath from the context menu.
That's the same what Firebug did. Only FirePath (a Firebug extension for creating XPaths and CSS selectors) and the Chrome DevTools create a relative path to the selected element.
I have now filed bug 1410810 asking to adjust the Firefox DevTools to also create a relative XPath.

Sphinx contents search results

I am currently using the read the doc theme for sphinxdoc version 1.4.6. When I search contents the queries display the title and the start of restructure text files instead of the the title and start of the html page. Is there any possible way I can change that?
Try the sphinx extension "sphinxprettysearchresults" (https://pypi.python.org/pypi/sphinxprettysearchresults).
Their website says this:
To display search results, Sphinx is fetching the source files of search hits and rendering excerpts in raw markup (Example).
This extension removes the markup from these source files (during build time), so the search results look decent.
However, when I load it on my project, I get an error, which I will have to report.
Maybe it works fine in your project.

Grab all HTML Source Code using VB6 WebBrowser Control

I've tried Webbrowser1.Document.body.OuterHTML and Webbrowser1.Document.body.innerHTML, but both are missing JS links and CSS stylings, any way to get the full html, seems it is just grabbing the html within the body not the full source.
Found out...
WebBrowser1.Document.documentElement.outerHTML

How to work with Xpath visualiser

I have downloaded XPath Visualizer Version 1.4 folder from
http://www.huttar.net/dimitre/XPV/TopXML-XPV.html link compatable to IE .I'm currently using Internet Explorer 8,then opened 'XPathMain.htm' file from the folder that is downloaded and tried to browse 'authors.xml' and gave xpath expression as //* and hit 'process file' button but i didnt get any output. Do i need to configure anything in my browser or include any jscript as such. There is nothing as such mentioned in 'read me' file.
You can use Xpath Explorer
Also check this site for online XPATH evaluator.
If have budget, go for XML SPY.

Resources