javascript - 用于在 python 中抓取 javascript 的 Selenium:使用 page_source
问题描述
尝试抓取网站的数据,但这些是由 javascript 编辑的。所以,退出使用 beautifulSoup 并改为 Selenium。但是,结果与我的代码相同。据我所知,使用 Selenium 可以抓取 javascripts html,但我找不到这些...
import requests
from bs4 import BeautifulSoup as bs
from selenium import webdriver
for url in Url_Number:
driver = webdriver.Chrome(C:\Python_Study\chromedriver.exe.')
driver.implicitly_wait(3)
Real_url = 'http://www.sbiz.or.kr/sijangtong/nation/onnuri/pop/onnuriShopListPopup.do?cpage=1&mkt_cd=100101&mkt_gubun=O&shop_table=SJTT.MKT_ELE_SHOP'
driver.get(Real_url)
html=driver.page_source
print(html)
print(html) 的结果,无法找出用 javascript 编写的表格数据...
如何使用 selenium 处理 javascript 数据?
解决方案
推荐阅读
- gnome - Compiling g-wrap
- python - How can I do a while loop that works regardless of what direction the loop goes?
- java - 聚焦阶段实际上并不聚焦
- sql - Is there a function that returns a default value for a string that is not a valid number
- windows-installer - MongoDB as a prerequisite in Advanced Installer
- reactjs -
React 中的组件使用 - r - sapply - 保留列名
- javascript - Angular 5 HttpClient.put 执行两个请求
- javascript - How can I change the style of a parent component?
- python - Serverless: Using a private Python package as a dependency