Justin Justin - 3 years ago 207
Python Question

Python Selenium Error Message - module has no element Chrome()

I built a web scraping tool in Python 3.6 that utilizes Selenium with the Chrome Webdriver. I have been using the script for weeks with no issues. I got a new laptop last week, and now my script is having issues. The chromedriver is in a file in my downloads file - but I point to the path.

Relevant Code Pieces:

from selenium import webdriver

browser = webdriver.Chrome("C:/Users/*****/Downloads/Install Files/ChromeDriver/chromedriver.exe")

Error Message:

Traceback (most recent call last):

File "ipython-input-16-6bf54a05a8d5", line 1, in module
driver = webdriver.Chrome("C:/Users/******/Downloads/Install
Files/ChromeDriver/chromedriver.exe")

AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'

I checked the selenium file and it doesn't have a "Chrome" folder, just "Firefox" and "Remote". I get the same error when I try to run webdriver.Firefox().

I am running Python with the Spyder IDE in the Anaconda 3 Package. Selenium was installed with pip. I have Selenium version 3.4.3 and chromedriver version 2.31

Answer Source

it works for me, try uninstalling your selenium package 'pip uninstall selenium' and install it back

from selenium import webdriver
driver = webdriver.Chrome(executable_path='C:\\Chrome Driver\\chromedriver.exe')
driver.get('https://www.google.com')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download