driver = webdriver.Chrome("D:\\Selenium program\\Chrome\\chromedriver.exe")
AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'
Process finished with exit code 1
Can any one help me with this error?
driver = webdriver.Chrome("D:\\Selenium program\\Chrome\\chromedriver.exe")
AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'
Process finished with exit code 1
Can any one help me with this error?
I believe your question is very incomplete.
To run Selenium with Chrome you need to install ChromeDriver. You can either download it and install, or use NPM (npm install chromedriver --global
).
If you're sure you have it installed, alongside with Python, and everything is working, then here's a basic example (from ChromeDriver
page).
import time
from selenium import webdriver
driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
The error your getting (AttributeError: module 'selenium.webdriver' has no attribute 'Chrome' Process finished with exit code 1
) seems to be because you don't have ChromeDriver installed.
In your code (the image you linked to the question) you're using webbrowser.open(url, new=2)
. Try to open using driver.get(url)
to see if it works.
Here's another similar question, if you want to check.