Python 类型错误:“模块”对象不可调用(导入 selenium 时)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16626734/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:11:26  来源:igfitidea点击:

TypeError: 'module' object is not callable ( when importing selenium )

pythonfirefoxseleniumwebdrivertypeerror

提问by Saleh_M

i have problem when running this code :

运行此代码时遇到问题:

>>> from selenium import webdriver
>>> driver = webdriver.firefox()
Traceback (most recent call last):
File "<pyshell#19>", line 1, in <module>
driver = webdriver.firefox()
TypeError: 'module' object is not callable

i have searched for the problem and i got some results. but unfortunately , they didn't work. So , how can i solve this?

我已经搜索了问题并得到了一些结果。但不幸的是,他们没有工作。那么,我该如何解决这个问题?

thanks.

谢谢。

采纳答案by Tadgh

You have made a typo.

你打错了。

webdriver.Firefox()

Note the capital F.

注意大写 F。

回答by Frank Musteman

the same goes for other browsers!

其他浏览器也一样!

e.g.

例如

webdriver.chrome Vs. webdriver.Chrome

(its even harder to notice this!)

(更难注意到这一点!)

thanks so much for the help! ;)

非常感谢你的帮忙!;)