'Import "webdriver_manager.chrome" could not be resolved when using Selenium in VS Code
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.
Solution 1:[1]
Instal this and restart.
pip install webdriver_manager
Solution 2:[2]
Had the same problem. You should restart your VS Code, it worked for me.
Solution 3:[3]
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
Solution 4:[4]
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
Solution 5:[5]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Carlost |
| Solution 2 | toribicks |
| Solution 3 | marc_s |
| Solution 4 | undetected Selenium |
| Solution 5 | Modestas |
