I have some text I need to extract using XPath selectors. The text can be in 3 different forms:
<td>
TARGET_TEXT
</td>
<td>
<p>
TARGET_TEXT
</p>
</td>
<td>
<p>
<strong>TARGET_TEXT</strong>
</p>
</td>
Is there an XPath statement/selector I can use that will handle all 3 of these scenarios? Or is it possible to add OR
statements in an XPath selector?
for tr in table_rows:
# only handles case 1
topic_name = tr.xpath('.//td[1]/text()').extract()[0]