Z
Z
Zelyoniy2018-04-02 14:25:56
Python
Zelyoniy, 2018-04-02 14:25:56

How to fix module search error?

Installed latest python, selenium, pip.
Through Pycharm I'm trying to run an elementary test
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('C:\\Python\\123\\chromedriver.exe')
driver.get(" www.google .com ")
to which the response is
"C:\Python\venv\Scripts\python.exe C:/Python/123/123.py
Traceback (most recent call last):
File "C:/Python/123/123. py", line 2, in
from selenium.webdriver.common.keys import Keys
ModuleNotFoundError: No module named 'selenium.webdriver.common'
Process finished with exit code 1"
Everything works correctly in IDLE.
If we remove the second line, we get
"AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wiserabbit, 2020-03-25
@wiserabbit

To fix this problem, you need to:
1) Go to the \Lib\site-packages\ subdirectory of the installed Python environment directory (for example, if Python was installed on the C: drive in the Python directory, then go to c:\Python\Lib\site- packages\)
2) Find the selenium directory in it. If there is none, but there is, for example, selenium-3.141.0.dist-info, you need to delete all directories
3) Run the console (Win + R-> cmd.exe-> Enter ) Run the selenium installation command again:
pip install selenium
4) Make sure that the selemium directory appeared in \Lib\site-packages\

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question