且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Python解析Selenium:TypeError:&;#39;模块&;#39;对象不可调用

更新时间:2022-06-15 03:59:18

此错误消息.

    driver = webdriver.ie(executable_path='C:/Selenium/Drivers/IEDriverServer.exe')
TypeError: 'module' object is not callable

.表示webdriver.ie是一个模块,不可调用

@JohnGordon在他的分析中相当正确。selenium.webdriver.ie.webdriver是与Selenium相关的Python Module之一,不可调用

若要通过启动会话,您需要将较小的i替换为大写I。因此,实际上您的代码行将是:

driver = webdriver.Ie(executable_path=r'C:SeleniumDriversIEDriverServer.exe')

您可以在TypeError: 'module' object is not callable error with driver=webdriver("C:Python34Libsite-packagesseleniumwebdriverchromedriver.exe")

中找到相关讨论