代码试验:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as Chromeoptions
chrome_options = Chromeoptions()
chrome_options.add_extension('Metamask.crx')
driver = webdriver.chrome("./chromedriver", options=chrome_options)
driver.get("Https://www.youtube.com")
driver.quit()
这是我编写的代码,但出现此错误:
类型错误:“模块”对象不可调用。
有人可以帮我解决这个问题吗?
chrome是一个模块。相反,你需要打电话Chrome()
as webdriver.Chrome()
您的有效代码行将是:
driver = webdriver.Chrome("./chromedriver", options=chrome_options)
参考
您可以在以下位置找到一些相关的详细讨论:
- TypeError: 'module' 对象不可调用错误 driver=webdriver("C:\Python34\Lib\site-packages\selenium\webdriver\chromedriver.exe") https://stackoverflow.com/questions/51243290/typeerror-module-object-is-not-callable-error-with-driver-webdriverc-pyth/51245550#51245550
- 如何用Python解决Selenium:TypeError: 'module' object is not callable https://stackoverflow.com/questions/59649959/how-to-resolve-selenium-with-python-typeerror-module-object-is-not-callable/59654170#59654170
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)