TypeError: 'module' object is not callable error with ChromeDriver and Chrome using Selenium on macos

Question:

When I try to test my test application to see if Selenium Chrome is working, I get this error:

driver= webdriver.chrome("/usr/local/bin/chromedriver")
 TypeError: 'module' object is not callable

I checked if it is installed

/usr/local/bin/chromedriver --version
ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})

But I still get errors even after restarting my computer.

My environment is:

  • Mac OS Catalina (10.15.6)
  • Chrome version: 84.0.4147.89
  • PyCharm Pro

What’s going wrong?

Asked By: Alain Seys

||

Answers:

The class webdriver.Chrome is case sensitive. Right now, you get this error because you are, inadvertently, trying to call the module webdriver.chrome.

If you change your code to

driver = webdriver.Chrome("/usr/local/bin/chromedriver") 

you should no longer get this error.

Answered By: dspencer

This error message…

TypeError: 'module' object is not callable

…implies that there was a calling the chrome module.


As per your code attempt you have used:

driver= webdriver.chrome()

Here interprets chrome as a submodule of webdriver:

chrome_module


Solution

Instead you need to call selenium.webdriver.chrome.webdriver Class method as follows preferably using the key executable_path as follows:

driver= webdriver.Chrome(executable_path='/usr/local/bin/chromedriver')
                  ^ note the uppercase C
Answered By: undetected Selenium

driver= webdriver.chrome("/usr/local/bin/chromedriver")

This should be driver= webdriver.Chrome("/usr/local/bin/chromedriver")

Answered By: Justin Lambert

try use capital "c"
Try Chrome() not chrome().
it will fixed.

Answered By: Ashraf