简体   繁体   English

如何使用Python Selenium在<和>之间获取文本

[英]How to get text beween < and > using Python Selenium

Further to question here . 在这里进一步质疑。

<a id='1234' href ="http://www.google.com' class='alpha' > MY TEXT </a>
<caption>
    <em> ABCD </em>
</caption>

I want to extract text between ie 我想提取ie之间的文本

id='1234' href ="http://www.google.com' class='alpha'

How to do this using python and selenium. 如何使用python和selenium做到这一点。

Use 采用

web_element.get_attribute(attribute_name) 

method on the web_element object to get the value of any attribute present in a web_element in this case id, href, class . web_element对象上的方法,以获取web_element中存在的任何属性的值,在本例中为id,href,class

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

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