import selenium
from selenium import webdriver
def init_driver():
driver = webdriver.chrome('C:/Users/Who/chromedriver.exe')
driver.wait = WebDriverWait(driver, 5)
return driver
Traceback (most recent call last):
File "C:\Users\Who\Documents\atom\c", line 154, in <module>
driver= init_driver()
File "C:\Users\Who\Documents\atom\c", line 15, in init_driver
driver = webdriver.chrome('C:/Users/Who/chromedriver.exe')
TypeError: 'module' object is not callable
[Finished in 0.902s]
Why is it like this when I keep getting the above error or the error that the webdriver is not defined while crawling through selenium?
selenium-webdrive
The command to specify the web driver is not at the top of the module.
import selenium
selenium.webdriver.chrome.webdriver.WebDriver(executable_path='chromedriver path')
https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.chrome.webdriver
© 2024 OneMinuteCode. All rights reserved.