How to get the content I want to mark using xpath in python
大家讲道理2017-05-24 11:35:18
0
4
821
I want to get the complete content under the a tag under h3 (Get a 5% saving on Ripleys Believe It or Not London Tickets). How to get this using xpath? I beg for advice from experts
The previous answer did not address the original poster’s question, because the original poster did not describe the problem clearly. I think what the original poster wanted to say is that you cannot get the content in the sub-tag by directly using the text() method or text attribute (assuming you have already seen it) The basic syntax of xpath). Google search xpath get all text, the first one is the answer. The poster can ask this question: How to use xpath to extract the text content contained in the tag (although the answer here is not satisfactory)
The most convenient way is to select it and there is an option to copy to xpath
Under chrome
right click on the element
copy->Copy XPath
The previous answer did not address the original poster’s question, because the original poster did not describe the problem clearly. I think what the original poster wanted to say is that you cannot get the content in the sub-tag by directly using the text() method or text attribute (assuming you have already seen it) The basic syntax of xpath).
Google search xpath get all text, the first one is the answer.
The poster can ask this question: How to use xpath to extract the text content contained in the tag (although the answer here is not satisfactory)
You try it
descendant-or-self indicates the current node and descendant nodes
normal-space() removes the descendant nodes of whitespace-only nodes (this is optional)
Reference link:
http://stackoverflow.com/ques...