简体   繁体   中英

how to fix this TypeError: 'module' object is not callable

Traceback (most recent call last):
  File "D:/PYTHON projects/chrome automation/main.py", line 3, in <module>
    driver = webdriver.chrome()
TypeError: 'module' object is not callable

I installed selenium and webdriver but this keeps happening. whats the problem?

The way to read this error is webdriver module does not have an object called "chrome()". It does have one called "Chrome()", so try this?

driver = webdriver.Chrome()

Also a good IDE will help you spot such issues quicker. Plenty of free ones out there.

Remember that Python is case sensitive.

https://chromedriver.chromium.org/getting-started

use:

driver = webdriver.Chrome('/path/to/chromedriver')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM