I am getting an issue in my code with webdriver not being imported. I am using selenium and have already made sure the path is correct. I do not have any file named 'selenium.py' or 'selenium.pyc' that is causing this issue. If it helps, I am using windows, not a mac.
When importing selenium and checking the file it was imported with I get the following input/output:
input:
import selenium
print(selenium.__file__)
output:
runfile('D:/Users/admin/temp2.py', wdir='D:/Users/admin')
C:\ProgramData\Anaconda3\lib\selenium\__init__.py
My code is as follows:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
dir_name = 'D:\\Users\\admin\\Desktop\\New folder'
chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory" : 'D:\\Users\\admin\\Desktop\\New
folder'}
chromeOptions.add_experimental_option("prefs",prefs)
chromedriver ='D:\\Users\\admin\\Desktop\chromedriver.exe'
driver = webdriver.Chrome(executable_path=chromedriver,
chrome_options=chromeOptions)
The Output:
runfile('D:/Users/admin/.spyder-py3/temp.py',
wdir='D:/Users/admin/.spyder-py3')
Traceback (most recent call last):
File "<ipython-input-3-c032ba6dd2a9>", line 1, in <module>
runfile('D:/Users/admin/.spyder-py3/temp.py',
wdir='D:/Users/admin/.spyder-py3')
File "C:\ProgramData\Anaconda3\lib\site-
packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-
packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/Users/admin/.spyder-py3/temp.py", line 2, in <module>
from selenium import webdriver
ImportError: cannot import name 'webdriver'