我正在尝试使用python、beautiful soup和selenium从一个实用程序网站上获取数据。我试图收集的数据是:时间、原因、状态等。当我运行一个典型的页面请求时,解析页面,并解析我正在寻找的数据(数据在 id="OutageListTable"), and print it, the divs and strings are nowhere to be found. When I inspect the page element, the data is there, but it is in a flex container.
这是我正在使用的代码:
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import urllib3
from selenium import webdriver
my_url = 'https://www.pse.com/outage/outage-map'
browser = webdriver.Firefox()
browser.get(my_url)
html = browser.page_source
page_soup = soup(html, features='lxml')
outage_list = page_soup.find(id='OutageListTable')
print(outage_list)
browser.quit()
如何检索flex/flexbox容器中的信息?我在网上找不到任何资源来帮助我解决这个问题
你想得太多了。首先,没有柔性板容器。这是一个分配正确的div类的简单例子。你应该看看}
div
{数据通过Javascript动态加载。您可以使用
requests
模块来获取数据例如:
印刷品:
相关问题 更多 >
编程相关推荐