You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Python导入Selenium报错TypeError: 'module'对象不可调用求助

解决Selenium报错TypeError: 'module' object is not callable

问题原因

你代码中的webdriver.chrome()写法错误,chrome是Selenium中的模块对象,并非可实例化的类,正确的调用方式是使用首字母大写的webdriver.Chrome()。

修正后的代码

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

# 修正首字母为大写的Chrome
driver = webdriver.Chrome()
driver.get("https://google.com")

额外说明

  • Selenium 4及以上版本内置了ChromeDriver自动管理机制,无需手动传入驱动路径,只要Chrome浏览器与Selenium版本兼容即可正常运行。
  • 如果问题仍存在,可尝试以下操作:
    • 执行pip install --upgrade selenium升级到最新版Selenium
    • 确认Chrome浏览器版本与Selenium版本匹配(推荐使用最新版Chrome对应最新版Selenium)
    • 避免手动下载并配置ChromeDriver路径,依赖Selenium自动管理即可

内容的提问来源于stack exchange,提问作者llRub3Nll

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 13:27:03