How to identify an element with no innerText using selenium?

Viewed 26

I have an element that looks like this:

<td style="font-weight: bold; text-align:right;"></td>

Is there anyway to change or detect the blank value between the tags in selenium python?

P/S: This is just an example. There are many elements like this in the data I'm working with.

1 Answers

As per the HTML:

<td style="font-weight: bold; text-align:right;"></td>

the <td> element doesn't have any text or innerText and in that case you can identify the <td> element as using the following xpath:

driver.findElements(By.xpath("//td[not(text())]"));

However, you have to take help of additional attributes so the locator strategy identify the element uniquely within the HTML DOM.

Related