2

enter image description here

It is possible to do this:

  • in the document I have several tables:

    ...

    table id="odds_ou_159.5"

    table id="odds_ou_160.5"

    table id="odds_ou_161.5"

    ...

  • Tables contain several classes:

    ...

    tr class = odd>

    tr class = odd>

    ...

  • class odd contain:

    td class = bookmaker ...

    td> 161.5 </td>

    td class = kx

    td class = kx

    td class = bonus

    ....

  • class kx contain:

    span class=" odds-wrap " eu="1.90"> 1.90

Now I need to get content of class odd or just text from <td> 161.5 </td>, but my condition has to be eu="1.90"

Is it possible to get content of Ancestors (in my case class odd) depending on attribute values of Descendants (in my case eu=1.90)

FelixSFD
6,10110 gold badges46 silver badges135 bronze badges
asked Dec 12, 2016 at 3:35

1 Answer 1

2

Try this XPath and let me know in case of any issues:

//td[span[@eu="1.90"]]/preceding-sibling::td
answered Dec 12, 2016 at 8:07
Sign up to request clarification or add additional context in comments.

2 Comments

@JakeSully, use single quotes for 1.90 when using in the code, as we use double quotes to provide XPath in findElement* methods.
Thank you, i wrote '//td[span[@class=" odds-wrap " and @eu="1.90"]]/preceding-sibling::td' and it works

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.