After all, XPath can parse the corresponding element from a formatted HTML lookup more quickly.
More formal site layout, you can copy the XPath path directly through Chrome's debugger. :
However, this approach may not be effective and will not get a set of values that are correctly searched.
How to find the content of an element that specifies class= ' xxx ' through XPath.
Documentnode.selectnodes ("//div[@class = ' Mainarea ']/ul/li");
Everyone can do so by:
div[@class = ' mainarea ') means to find node with a class value of Mainarea from the root (//).
So, then it is very simple//an element [@class = ' class value ']
You can follow this formula to find the elements of class.
The remaining/ul/li represents the collection of LI nodes that continue to look for the class= ' Mainarea ' div including the UL elements below.
Above is just a case. You can view the XPath class
XPATH finds the specified class element