| 
 | 
 
5鱼币 
 本帖最后由 tengke 于 2024-4-8 09:37 编辑  
 
from selenium import webdriver 
 
# 指定 ChromeDriver 的路径 
chrome_driver_path = r'C:\Users\huawei\Desktop\chromedriver-win64\chromedriver.exe'  # 将路径替换为你实际的 ChromeDriver 路径 
 
# 指定谷歌浏览器的路径 
chrome_binary_path = r'C:\Users\huawei\Desktop\chrome-win64\chrome.exe'  # 将路径替换为你实际的谷歌浏览器路径 
 
# 创建 ChromeDriver 实例并指定谷歌浏览器的路径 
chrome_options = webdriver.ChromeOptions() 
chrome_options.binary_location = chrome_binary_path 
 
# 使用指定的 ChromeDriver 路径创建 Chrome 实例 
driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options) 
 
# 打开百度网站 
driver.get("https://www.baidu.com") 
 
 
Traceback (most recent call last): 
  File "D:\软件\djangoProject\app\zspc.py", line 14, in <module> 
    driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options) 
TypeError: __init__() got an unexpected keyword argument 'executable_path' 
 
 
 
 
 
 
 
https://googlechromelabs.github.io/chrome-for-testing/ 都是123.0.6312.105 |   
 
 
 
 
 
 |