[英]How do I scrape text from a website using Selenium
How do I scrape text from a website using Selenium?如何使用 Selenium 从网站上抓取文本? I need to get an inner text from a website.
我需要从网站获取内部文本。 I'm using the newest Python and Selenium, all up to date.
我使用的是最新的 Python 和 Selenium,都是最新的。 I also have pyautogui.
我也有pyautogui。
Here is what I need to scrape:这是我需要刮的:
<span class="ng-binding" ng-bind-html="addKeysInMatch(characterMatch.bad)">Gorgeous Geodes Glowed</span>
I don't know part of the text though, the "Gorgeous Geodes Glowed" is what I don't know, and I need to find that.不过,我不知道部分文字,“Gorgeous Geodes Glowed”是我不知道的,我需要找到它。
Thanks in advance.提前致谢。
titles_element = driver.find_elements_by_xpath("//span[@class='ng-binding']")
titles = [x.text for x in titles_element]
titles = []
for x in titles_element:
titles.append(x.text)
print(titles)
The Gorgeous Geodes Glowed is the text that appears after the span class is Identified. Gorgeous Geodes Glowed 是在span类被Identified后出现的文字。 So every time this class appears it will print out the following text.
所以每次这个类出现时都会打印出下面的文字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.