Selenium初始化Chrome驱动报错:'module' object is not callable
问题解决:TypeError: 'module' object is not callable
你的错误根源是大小写拼写错误:在Selenium中,实例化Chrome驱动的正确写法是webdriver.Chrome(),而非webdriver.chrome()。
原因解释
webdriver.chrome是一个模块对象,本身不可被调用,因此会抛出"`module' object is not callable"的错误;webdriver.Chrome()才是Selenium提供的、用于创建Chrome驱动实例的可调用类。
修正后的代码
from selenium import webdriver driver = webdriver.Chrome()
额外说明
不需要重复重装驱动、浏览器、Selenium或Python,这个问题和环境配置无关。如果使用的是Selenium 4.6及以上版本,Selenium会自动通过内置的Selenium Manager管理驱动,无需手动下载或配置环境变量。
内容的提问来源于stack exchange,提问作者No Name
相关产品推荐
相关产品推荐

