3

I'm trying to get the value between the div, as I am trying to continue the program once the code has been introduced correctly. However I can't seem to get the value from the element. Value is in this case '12345678'

<td id="TransaccionTesoreriaRetencionItems_NroComprobanteRetencion_1" height="22px">
    <div style="width: 115px; overflow: hidden; cursor: pointer;">
        12345678&nbsp;&nbsp;&nbsp;
    </div>
</td>

Code image

Feso
  • 31
  • 3

1 Answers1

1

To print the text 12345678 you can use either of the following locator strategies:

  • Using css_selector:

    print(driver.find_element(By.CSS_SELECTOR, "td#TransaccionTesoreriaRetencionItems_NroComprobanteRetencion_1 > div").text)
    
  • Using xpath:

    print(driver.find_element(By.XPATH, "//td[@id='TransaccionTesoreriaRetencionItems_NroComprobanteRetencion_1']/div").text)
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352