I am a newbie for selenium python. I have installed python, pip etc.. I am trying to run the below code but it is showing error:
ImportError: cannot import name 'webdriver'
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://www.python.org")
could anyone please solve this issue?
If your file name is selenium.py
, change it to something else and delete .pyc
files or the __pycache__
directory if exists.
If you do not have the selenium, you should install the selenium
by using pip
or pipenv
:
pip install selenium
It says that webdriver cant be import.So I assume you have Selenium installed.
So I can only assume that the selenium lied in different place in your path.
Maybe you have accidently create a file named selenium ?
Step 1: First rename filename if saved with selenium.py
and delete selenium.pyc
.
mv selenium.py test.py
rm selenium.pyc
Step 2: import module selenium if not already installed.
pip install selenium
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With