4

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • Sorry, I can't reproduce your problem on my computer. Can you try to upgrade or downgrade the `Pylance Extension`? – Steven-MSFT Jun 29 '21 at 11:26

5 Answers5

4

Instal this and restart.

pip install webdriver_manager
Carlost
  • 478
  • 5
  • 13
3

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

toribicks
  • 31
  • 4
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30877860) – Simas Joneliunas Jan 26 '22 at 08:34
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

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

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

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
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

Modestas
  • 55
  • 5