error while importing webdriver from selenium in python

4.1k views Asked by At

The first thing I wanted to do is, installing Selenium in Windows and import webdriver from selenium.

So, I installed Selenium with pip install selenium and tried to import webdriver with:

from selenium import webdriver

But I got the error:

File "C:\Users\VIJAY\Desktop\selenium.py", line 2, in from selenium import webdriver ImportError: cannot import name 'webdriver'

Where am I going wrong?

2

There are 2 answers

0
Prasan Singh On

Change your program name to something else like scraping if you are practicing it. Or else try installing it from the python console.

import selenium
from selenium import webdriver
0
whackamadoodle3000 On

Rename your file from selenium.py to something else. Also, make sure there is nothing named selenium in your desktop folder. You are probably not importing the library, but rather a python file.