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

Python Selenium如何解决'module' object is not callable报错

报错原因

你调用的webdriver.chrome是Selenium里的子模块,不是可实例化的类,所以会触发模块不可调用的报错。Selenium中Chrome浏览器的驱动类是大写开头的Chrome,属于webdriver模块下的可调用对象。

修复方法

直接修改实例化driver的一行代码,把小写的chrome改为大写的Chrome即可。

修改后的完整可运行代码:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

option = Options()
option.add_argument("start-maximized")
# 此处chrome改为首字母大写的Chrome
driver = webdriver.Chrome(options=option)

driver.get("http://twitter.com/login")

如果你使用的是Selenium 4.6及以上版本,不需要额外手动下载配置ChromeDriver,Selenium内置的驱动管理工具会自动匹配你本地Chrome版本对应的驱动。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.27 02:45:04