-3

I have this code and it's not working. How can I resolve it?

from selenium import webdriver  # to control browser operations
from selenium.webdriver.common.keys import keys
from io import Bytesio
from io import Stringio


runfile('/Users/saksham/saksham py/voice.py', wdir='/Users/saksham/saksham py')
Traceback (most recent call last):

  File "<ipython-input-1-f68c9e511ab8>", line 1, in <module>
    runfile('/Users/saksham/saksham py/voice.py', wdir='/Users/saksham/saksham py')

  File "/Users/saksham/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "/Users/saksham/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/Users/saksham/saksham py/voice.py", line 9, in <module>
    from selenium.webdriver.common.keys import keys

ImportError: cannot import name 'keys' from 'selenium.webdriver.common.keys' (/Users/saksham/anaconda3/lib/python3.7/site-packages/selenium/webdriver/common/keys.py)
halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

1

Replace

from selenium.webdriver.common.keys import keys

With

from selenium.webdriver.common.keys import Keys

Based on the documentation

Edeki Okoh
  • 1,786
  • 15
  • 27