html - VB Agility Pack XPath select sub node in parent based on another sub nodes value -


i have html dom so:

<div class="productcontainer">     <div class="image jsthumbnailreplace">         <a href="">             <img src="/img/noimagemedium.jpg"/>         </a>     </div>     <div class="productdata"         <div class="descriptionsection">             <div class="title">title</div>         </div>     </div> </div> 

i want select title text if source in image tag contains "noimagemedium". use visual studio 2010 vb.net , html agility pack achieve this. debugger says xpath expression invalid.

i thought xpath should doesn´t work:

//div[@class='descriptionsection']/div[@class='title'][//div[@class='productcontainer']/div[contains(@class, 'image') , contains(@class, 'jsthumbnailreplace')]/a/img[contains(@src, 'noimagemedium')]] 

apparently syntax wrong can´t figure out. appreciated :)

i found solution myself. crux right after first "and". don´t need opening bracket, can directly call path. important note contains() doesn´t search through raw node-text, have specify either text or attribute. knowledge in mind build xpath.

//div[@class='productcontainer' , div[1]/a/img[contains(@src, 'noimagemedium')]]/div[@class='descriptionsection']/div[@class='title']" 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -