I'm trying to extract the text value following a b tag that contains specific text. I'm using Selenium web driver with Python3.
The HTML inspected for the value I'm trying to return (11,847) is here:
This has an Xpath below (I'm not using this xpath directly to find the element as the table construction changes for different examples that I plan to iterate through):
/html/body/form[1]/div[2]/table[2]/tbody/tr[3]/td[2]/text()
As an example, when I print the below it returns Att: i.e. the element located by my search for the text 'Att' within the b tags.
att=driver.find_element("xpath",".//b[contains(text(), 'Att')]").text
print(att)
Is there a way I can return the value following <b>Att:</b>
by searching for 'Att:' (or conversly, I'd also like to return the value following <b>Ref:</b>
.
Thanks in advance.