Import "webdriver_manager.chrome" could not be resolved when using Selenium in VS Code
Asked Answered
U

5

6

I'm trying to use Selenium to test a web app, and my tests are running smoothly using webdriver-manager. I already pip installed the webdriver_manager and selenium. I am using the chrome driver, so the first lines of my code are

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(ChromeDriverManager().install())

As I already said, the code runs and my tests are carried out. However, since I am using VS Code, the line webdriver_manager.chrome is highlighted in yellow with the warning Import "webdriver_manager.chrome" could not be resolved Pylance (reportMissingErrors).

Does anyone know how to remove this warning or how to fix it? Thanks so much in advance.

Unready answered 4/6, 2021 at 20:30 Comment(1)
Sorry, I can't reproduce your problem on my computer. Can you try to upgrade or downgrade the Pylance Extension?Boxer
D
5

Had the same problem. You should restart your VS Code, it worked for me.

Debbiedebbra answered 21/1, 2022 at 19:26 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewSouthwestwards
P
4

Instal this and restart.

pip install webdriver_manager
Papyraceous answered 6/1, 2022 at 15:54 Comment(0)
M
1

At times pip3 works better than normal pip as it installs correct dependencies.

I'd recomment to use pip3 to install webdriver_manager as follows:

pip3 install webdriver_manager

Additionally, you may need to restart the VS Code

Mickimickie answered 21/1, 2022 at 23:48 Comment(0)
A
0

Had this issue while coding on PyCharm. I reinstalled the package with pip install webdriver_manager and updated pip because it was outdated and got everything working now

Anticlastic answered 26/4, 2022 at 5:57 Comment(0)
W
-1

Replacing webdriver_manager.chrome with driver = webdriver.Chrome('..\drivers\chromedriver') should solve your issue.

If you have any more questions, I prefer if you ask me in here https://discord.gg/fjNX5MuTVq

Wakeful answered 4/6, 2021 at 21:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.