python - Python:无法通过网络浏览器传递 url
问题描述
我正在尝试使用 python selenium 抓取网络数据,但是当我运行能够打开浏览器的 py 代码但它没有将 url 传递到网络浏览器时,下面是我正在使用的示例代码。
import requests
from selenium import webdriver
Chromepath = r"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
url = "https://climate.weather.gc.ca/historical_data/search_historic_data_e.html"
driver = webdriver.Chrome(Chromepath)
driver.get(url)
提前致谢。
解决方案
我通过安装 webdrivers 解决了这个问题。
import requests
from selenium import webdriver
# Chromepath = r"C:\\Program Files x86)\\Google\\Chrome\\Application\\chrome.exe"
Chromepath = r"C:\\Ecomm\\chromedriver_win32\\chromedriver.exe"
url = "https://climate.weather.gc.ca/historical_data/search_historic_data_e.html"
driver = webdriver.Chrome(Chromepath)
driver.get(url)
推荐阅读
- angular - 来自基本组件的 Angular HostBinding 属性
- python - GCP 身份验证:RefreshError
- html - 带有“;”的网页颜色
- google-cloud-platform - 我可以在 GCP 实例中将“默认”VPC 更改为共享 VPC 吗?
- xml - 在类对象的 XML 序列化期间发生重复
- python - DBSCAN 提供线作为输入
- typescript - 使用模块源路径启用 TSlint 有序导入规则
- azure - Azure 搜索 .NET SDK:SearchIndexClient 和依赖注入
- php - 激活typo3 8 扩展时出错
- python - 什么构成了python环境