江澄748 2022-07-21 13:04 采纳率: 100%
浏览 69
已结题

用py写代码来打开chrome浏览器,报错

原代码from selenium import webdriver
from selenium.webdriver.chrome.service import Service

尝试传参

s = Service("chromedriver.exe")
driver = webdriver.Chrome(service=s)

driver.get('https://www.baidu.com/')
driver.quit()

报错代码
Traceback (most recent call last):
File "C:/Users/27716/Desktop/pycode/selecode/anli.py", line 6, in
driver = webdriver.Chrome(service=s)
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in init
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 92, in init
RemoteWebDriver.init(
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 275, in init
self.start_session(capabilities, browser_profile)
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 365, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute
self.error_handler.check_response(response)
File "C:\Users\27716\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process.
Stacktrace:
Backtrace:
Ordinal0 [0x008B6463+2188387]
Ordinal0 [0x0084E461+1762401]
Ordinal0 [0x00763D78+802168]
Ordinal0 [0x00780CB4+920756]
Ordinal0 [0x0077E331+910129]
Ordinal0 [0x007B1430+1119280]
Ordinal0 [0x007B108A+1118346]
Ordinal0 [0x007AC5F6+1099254]
Ordinal0 [0x00786BE0+945120]
Ordinal0 [0x00787AD6+948950]
GetHandleVerifier [0x00B571F2+2712546]
GetHandleVerifier [0x00B4886D+2652765]
GetHandleVerifier [0x0094002A+520730]
GetHandleVerifier [0x0093EE06+516086]
Ordinal0 [0x0085468B+1787531]
Ordinal0 [0x00858E88+1805960]
Or

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 系统已结题 8月5日
      • 已采纳回答 7月28日
      • 创建了问题 7月21日

      悬赏问题

      • ¥15 postman测试正常,在代码运行报错
      • ¥15 关于#C语言#的问题,如何解决?
      • ¥20 Vs2017 Help Viewer2.3 问题
      • ¥35 基于嵌入式linux的日程管理软件
      • ¥50 如何将list字符串添加到CSV文件表头?
      • ¥15 关于#javascript#的问题:通过ajax实现的局部刷新 如何将项目打包
      • ¥15 海思uboot USB3.0无法识别
      • ¥15 无法调用库文件,自己可以找到,但编译时显示没有
      • ¥15 安装PyQt5的时候这里创建虚拟环境是哪里?具体是怎么的?能录个视频吗
      • ¥20 php程序设计题不会!求解答!