Xpath Required for identifying nodes based on a criteria in Selenium. -


i'm working on selenium project.

i have html file (copied below) have write xpath expression in order find out value of 6th "b" element under "a" which:

  • 2nd "b" has value of "888" ,
  • 4th "666" has value of "world great".

html code

 <a>     <b>111</b>     <b>222</b>     <b>333</b>     <b>444</b>     <b>ttt</b>     <b>uuu</b> </a>  <a>     <b>999</b>     <b>888</b>     <b>777</b>     <b>world great</b>     <b>aaa</b>     <b>bbb</b> </a> 

i tried following, didn't work. appreciated.

//a[b='888'][b='world great']/b[6]  //a[contains(@b[2], '888') , contains(@b[4], 'world great')]/b[6] 

q.: (modified) to find out value of 6th "b" element under "a" - -- 2nd "b" has value of "888" , -- 4th "b" has value of "world great"

try this:

"//a[b[2]='888' , b[4] = 'world great' ]/b[6]" 

attention: fist try //a[b='888'][b='world great']/b[6] should work. if not return "bbb" example there else wrong.


Comments