I have this HTML
<tr height="22px">
<td colspan="1" class="det" width="40%">Net Sales</td>
<td align="right" class="det">2,548.00</td>
<td align="right" class="det">1,946.36</td>
<td align="right" class="det">1,139.14</td>
<td align="right" class="det">2,345.60</td>
<td align="right" class="det">1,323.84</td>
</tr>
I find the element using text:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("url")
quarterly_results_data = driver.find_element_by_xpath("//* [contains(text(),'Net Sales)]")
print(quarterly_results_data.text)
I get:
Net Sales
However I want all the text between parent <tr>:
Net Sales
2,548
1,946
...
Using :
print(quarterly_results_data.parent.text)
does not give any results.
I know it can be done by beautifulsoup, but I will have to use html parser every time i click on a new link. Please help with the right syntax.