简体   繁体   中英

extracting text after br tag in selenium python

[enter image description here][1]I have seen similar questions before but none of them has a correct working solution. That's why I am posting it. So I need to extract the text after br tag. I am working on Selenium Python and have tried almost every solution from here but none of them worked.

This is the selenium python code:

 #extract received value
        received = driver.find_element_by_xpath('(//span[@class="dash-label"])[1]').text
        print(received)

Attached is the image of the html code [1]: https://i.stack.imgur.com/cfCwS.png

Use below xpath code

received = driver.find_element_by_xpath('//span[text()="Received"]/..').text
print(received)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM