0
指定したtasgに特定のテキストが含まれている場合は、値を抽出します。Xpathが含まれている場合
入力:
<section class='question-other-answers'>
\t <article>
\t \t <div class='user' </div>
\t \t
\t \t <div class='details'>
\t \t
\t \t \t <p class='content'>
\t \t \t \t exampleXYZexample
\t \t \t </p> \t
\t \t </div>
\t \t
\t \t <div class='info'>
\t \t \t <div class='rating'>
\t \t \t \t <div class='rate-up'>
\t \t \t \t \t <a>123456789</a>
\t \t \t \t </div>
\t \t \t \t
\t \t \t \t <div class='rate-down'>
\t \t \t \t \t <a>123456789</a>
\t \t \t \t </div> \t
\t \t \t </div>
\t \t </div>
\t \t
\t </article>
</section>
私は何をしたいです:<p class='content'>
はXYZ
が含まれている場合、コンテンツがXYZ
rate-up
値は、私がチェックする方法を知っています
//section[@class='question-other-answers']/article/div[2]/p and contains (.,'XYZ')
そして、私はrate-up
値
//section[@class='question-other-answers']/article/div[3]/div/div[1]/a
を取得する方法を知っている。しかし、私はそう
//section[@class='question-other-answers']/article[div[2]/p[@class = 'content' and contains (.,'XYZ')]]/div[3]/div/div[1]/a
でどのようにそれらを組み合わせること
うまく動作しません。これは、 'content'に' XYZ'があっても抽出します。これを試してみてください:http://pastebin.com/T2jLmtNw – audiophonic
@audiophonic、編集を参照してください、あなたが確認したい関係をそれぞれ特定したいと思っているのは明らかです。 –