Python:无法通过web浏览器传递url

Python:无法通过web浏览器传递url,python,selenium,Python,Selenium,我试图使用python selenium来刮取web数据,但是当我运行py代码时,它能够打开浏览器,但是它没有将url传递到web浏览器中,下面是我使用的示例代码 import requests from selenium import webdriver Chromepath = r"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" url = "https://climate.

我试图使用python selenium来刮取web数据,但是当我运行py代码时,它能够打开浏览器,但是它没有将url传递到web浏览器中,下面是我使用的示例代码

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)

提前感谢。

从下载Chrome驱动程序,然后您可以尝试以下方法:

import time
from selenium import webdriver

url = "https://climate.weather.gc.ca/historical_data/search_historic_data_e.html"
driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
driver.get(url);
time.sleep(5) # Let the user actually see something!
driver.quit()

.

我通过安装WebDriver解决了这个问题

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)

谢谢你的回复。。祝您今天过得愉快。