我有这个website,我想下载页面的内容。使用python下载动态加载的网页
我试过selenium,并点击按钮,但没有成功。
#!/usr/bin/env python
from contextlib import closing
from selenium.webdriver import Firefox
import time
# use firefox to get page with javascript generated content
with closing(Firefox()) as browser:
# setting the url
browser.get("http://bonusbagging.co.uk/oddsmatching.php#")
# finding and clicking the button
button = browser.find_element_by_id('select_button')
button.click()
page = browser.page_source
time.sleep(5)
print(page.encode("utf8"))
此代码只下载隐藏数据的源代码。
有人可以告诉我正确的方法吗?或者告诉我如何可以下载隐藏的数据?
在此先感谢!
你试过用beautifulSoup吗? –