I am trying to extract on the number from this html element:
<td bgcolor="green">
<font color="white">
"49.8 "
<small>dBmV</small>
</font>
</td>
How do only extract the 49.8 without getting the bBmV also?
I am able to use the xpath on to return the all of 49.8 dbmv but when searching the xpath of just "49.8" I receive error
Error:
invalid selector: The result of the xpath expression "/html/body/p[1]/table/tbody/tr/td/table[2]/tbody/tr[2]/td[4]/font/text()" is: [object Text]. It should be an element.
I have tried:
browser.find_element_by_xpath("/html/body/p[1]/table/tbody/tr/td/table[2]/tbody/tr[2]/td[4]/font").text
which returns 49.8 dBmV
And then:
browser.find_element_by_xpath("/html/body/p[1]/table/tbody/tr/td/table[2]/tbody/tr[2]/td[4]/font/text()").text
returns the exception above.
I just want the number 49.8 (which changes obviously). i know i could extract the number later but im hoping there something I can use to just to get the details directly from the html, something a bit tidier