1

Hi I'm trying to find those lines save the numbers 30.1 and -10.5 and click on Tony Marco. I'm triying VaR=driver.get_element_by_xpath("//id[contains(@class, 'PointsTabL PointsSel')]//*[contains(@title,'VaR')]") but doesn´t work. Could anybody help me please.

<td>
     <a id="po-s-23320221-h" href="javascript:$M('po').onPoint('s',23320221,'h',30.1)" class="PointsTabL PointsSel">
        <span class="VaR">30.1</span>
        <span class="VaM">-10.5</span>
        <span class="VaL" title="Tony Marco">Tony Marco</span>
     </a>
    </td>

1 Answer 1

1

//id[contains(@class, 'PointsTabL PointsSel')]//*[contains(@title,'VaR')]would match nothing for 2 reasons:

  • you are checking the class attribute of an id element (?) - instead you should use a
  • you are checking if VaR is inside a title attribute but need to check the class

Fixed version:

//a[contains(@class, 'PointsTabL PointsSel')]//*[contains(@class,'VaR')]

Or, a more concise CSS selector:

VaR = driver.get_element_by_css_selector("a.PointsTabL.PointsSel .VaR")
print(VaR.text)
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much!! Thanks to you I can continue.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.