Python 3.x 类型错误:';模块';对象不能在pycharm中使用Seleniumthrough Python调用 执行时,我面临类型错误。我无法打开firefox和chrome驱动程序 我已经安装了chrome和gecko驱动程序

Python 3.x 类型错误:';模块';对象不能在pycharm中使用Seleniumthrough Python调用 执行时,我面临类型错误。我无法打开firefox和chrome驱动程序 我已经安装了chrome和gecko驱动程序,python-3.x,selenium-webdriver,firefox,webdriver,geckodriver,Python 3.x,Selenium Webdriver,Firefox,Webdriver,Geckodriver,我的脚本旁边有我的“geckodriver.exe” from selenium import webdriver driver=webdriver.firefox("D:\Pycharm_automation\geckodriver-v0.27.0-win64\geckodriver.exe") driver.get("google.com") 此错误消息 from selenium.webdriver import Firefox from sel

我的脚本旁边有我的“geckodriver.exe”

from selenium import webdriver

driver=webdriver.firefox("D:\Pycharm_automation\geckodriver-v0.27.0-win64\geckodriver.exe")
driver.get("google.com")
此错误消息

from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

import time
opts = Options()   
browser = Firefox(options=opts)
browser.get("www.google.de")
…表示您的代码试图调用不可调用的firefox模块

firefox
webdriver
模块中的一个子模块


解决方案 相反,您需要调用
Firefox()
。您需要将
firefox
替换为
firefox
。实际上,您的代码块将是:

TypeError: 'module' object is not callable

尝试将路径中的
\
替换为
\
。您好,问题仍在发生…这就像“TypeError:\uuu init\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu?
from selenium import webdriver

driver = webdriver.Firefox(executable_path=r'D:\Pycharm_automation\geckodriver-v0.27.0-win64\geckodriver.exe')
driver.get("google.com")