Home > Net >  Ask a question of xpath
Ask a question of xpath

Time:01-07

Ask a question of xpath, need according to the text, check out the following nodes:


Blog


I write xpath://div [contains (text (), 'Blog')], why the query fails?
This node, in addition to the text, there are other child nodes, should judge how to write text xpath?

CodePudding user response:

See the MSDN inside, the xpath path usage, not for a long time

CodePudding user response:

Check the documentation, found no way,

CodePudding user response:

Use the string () function convert all the contents of the div node to text, then the contains no,
For example,
//div [contains (string (), 'Blog')]

CodePudding user response:

The
reference 3 floor morning to evening reply:
use string () function convert all the contents of the div node to text, then the contains no,
For example,
//div [contains (string (), 'Blog')]


Use the string will match to outer multiple div, with the words I need to match the innermost only contain blog div,
But also thank you very much for your thoughts!
See if there is any other way, or xpath functions can be called,
  •  Tags:  
  • C #
  • Related