Search code examples
xpath

how can I obtain a td with no value?


I have a table in which sometimes some records dont have a value

this is what the chrome console shows me

I am using these Xpath

//table/tbody/tr/td[not(td[string-length(normalize-space(text()))=0])]

//td[not(td[string-length(normalize-space(text()))=0])]

but it selects the whole table, how can I select only the td which are empty?

Thank you for all the help :)


Solution

  • Let's keep things simple. If you want to select tds without text try:

    //table/tbody/tr/td[not(text())]
    

    Demo