繁体   English   中英

如何使用 python selenium 在 html 代码 [Instagram] 中创建一个值

[英]how to carve out a value in html code [Instagram] using python selenium

我想使用 python selenium 计算出追随者人数。 例如,如何从下面的 html 中雕刻出“108,381”以下的数字? 请帮忙

<a class="-nal3 " href="/accounts/login/?next=%2Fj_wontagii%2Ffollowers%2F&amp;source=followed_by_list">팔로워 <span class="g47SY " title="108,381">108천</span></a>

<span class="g47SY " title="108,381">108천</span>

尝试以下选项。您必须使用title属性来获取值。

driver.find_element_by_class_name("g47SY ").get_attribute("title")

或者

driver.find_element_by_css_selector("span.g47SY ").get_attribute("title")

或者

driver.find_element_by_xpath("//span[@class='g47SY ']").get_attribute("title")

暂无
暂无

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

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