Selenium Unable to Import Keys

I’ve tried searching here a few times for a relevant thread but have not been able to find anything. Not sure if it’s an issue with how I installed selenium/ version etc. Below is the code I’m trying to run along with the error I received.

Any help is greatly appreciated. Thank you!


import selenium
from seleniumimport webdriver
from selenium.webdriver.common.keysimport keys
import time

class TwitterBot:
def \_init\_(self,username,password):
self.username = username
self.password = password = webdriver.Firefox()

def login(self):
email = bot.find_element_by_class_name('js-username-field email-input js-initial-focus')
password = bot.find_element_by_class_name('js-password-field')

ducks = TwitterBot('', '\*\*\*\*\*\*\*\*\*')


from selenium.webdriver.common.keys import keys
ImportError: cannot import name ‘keys’ from ‘selenium.webdriver.common.keys’ (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/common/

Please anyone help here, i am alsogetting same error.

E:\Seleniumpython\venv\Scripts\python.exe E:/Seleniumpython/
Traceback (most recent call last):
File “E:/Seleniumpython/”, line 6, in <module>“E:\Driver\chromedriver_win32\chromedriver”)
TypeError: ‘module’ object is not callable

1 Like

Hey, may be this could help:

from selenium.webdriver.common.keys import Keys

k is capitals in Keys… check if it works


Thanks man Its really worked.

Finally can work on the facebook bot i was on making.

Again man thanks a lot.

Had the same issue but worked as you suggested (K not k). Thanks. 

hello i have a problem when try run my code, you can help? below my code and message error.


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

class InstagramBot:
    def __init__(self, username, password):
        self.username = username
        self.password = password = webdriver.Firefox(executable_path=r"C:\Users\Geovane\Desktop\geckodriver\geckodriver.exe")

    def long (self):
        bot =

PS C:\Users\Geovane\Desktop\igBot> & C:/Users/Geovane/AppData/Local/Programs/Python/Python38-32/python.exe c:/Users/Geovane/Desktop/igBot/
Traceback (most recent call last):
File “c:/Users/Geovane/Desktop/igBot/”, line 1, in <module>
from selenium import webdriver
File “C:\Users\Geovane\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\”, line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File “C:\Users\Geovane\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\”, line 36, in <module>
from .service import Service
File “C:\Users\Geovane\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\firefox\”, line 21, in <module>
class Service(service.Service):
AttributeError: module ‘selenium.webdriver.common.service’ has no attribute ‘Service’
PS C:\Users\Geovane\Desktop\igBot>

That worked. thank you!