unable to import selenium.webdriver.common.keys Does anyone knows how to solve this?

217 views Asked by At

enter image description here

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()
driver.get("https://www.google.com/")

I'm trying to use selenium for studying crawling. Using M1 Mac.

I barely find answers to that error.

Does anyone know how to solve this in vs code?

When I run the code by typing %python google.py, it starts to open the website but it closes it right after.

I matched the version between chrome and chromedriver (mac-arm-64)(112.xx.xx.x.x.)

The code in copied from 'https://selenium-python.readthedocs.io/getting-started.html'

Only the url was edited

I want to solve that error and let this code work fine.

1

There are 1 answers

3
JialeDu On

That's Linting's warning, adding the following content in settings.json to close Linting.

    "python.linting.enabled": false

Or search for python.linting.enabled on the Settings and then cancel the check.

enter image description here

More content about Linting.