我想使用chromedriver收集网页的信息。如何安装和使用它?
最佳答案
如果您还没有安装selenium,则必须先安装它。然后使用 Selenium :
from selenium.webdriver import Chrome
url="URL of the webpage you want to read"
设置驱动程序
webdriver = "path of the chromedriver.exe file saved in your pc"
driver.get(url)
使用 CSS 选择器
y = driver.find_element_by_css_selector('css selector of the data you want to read from the webpage').text
print(y)
关于pandas - 如何在pandas中使用selenium来读取网页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61644255/