简体   繁体   English

在 selenium python 中的 br 标记之后提取文本

[英]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. [在此处输入图片描述][1]我以前见过类似的问题,但没有一个有正确的工作解决方案。 That's why I am posting it.这就是我发布它的原因。 So I need to extract the text after br tag.所以我需要提取 br 标签后的文本。 I am working on Selenium Python and have tried almost every solution from here but none of them worked.我正在研究 Selenium Python 并尝试了这里的几乎所有解决方案,但没有一个有效。

This is the selenium python code:这是 selenium python 代码:

 #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附上html代码图[1]: https://i.stack.imgur.com/cfCwS.png

Use below xpath code下面使用 xpath 代码

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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