Python Selenium 'module' object is not callable in python selenium script
Question: Learning Selenium driven by Python and in my practice I keep getting the
following error. I am stuck and could use some guidance

> Traceback (most recent call last): File "test_login.py", line 14, in
> test_Login loginpage = homePage(self.driver) TypeError: 'module' object is
> not callable

Here is my code

> test_login.py
    
    
    import unittest
    import homePage
    from selenium import webdriver
    
    class Login(unittest.TestCase):
    
      def setUp(self):
         self.driver = webdriver.Firefox()
         self.driver.get("https://hub.docker.com/login/")
    
      def test_Login(self):
          loginpage = homePage(self.driver)
          loginpage.login(email,password)
    
      def tearDown(self):
          self.driver.close()
    
    if __name__ == '__main__': unittest.main()
    

> homePage.py
    
    
    from selenium.webdriver.common.by import By
    
    class BasePage(object):
    
        def __init__(self, driver):
            self.driver = drive
    
    
    class LoginPage(BasePage):
        locator_dictionary = {
            "userID": (By.XPATH, '//input[@placeholder="Username"]'),
            "passWord": (By.XPATH, '//input[@placeholder="Password"]'),
            "submittButton": (By.XPATH, '//button[text()="Log In"]'),
        }
    
    
    
        def set_userID(self, id):
            userIdElement = self.driver.find_element(*LoginPage.userID)
            userIdElement.send_keys(id)
    
        def login_error_displayed(self):
            notifcationElement = self.driver.find_element(*LoginPage.loginError)
            return notifcationElement.is_displayed()
    
        def set_password(self, password):
            pwordElement = self.driver.find_element(*LoginPage.passWord)
            pwordElement.send_keys(password)        
    
        def click_submit(self):
            submitBttn = self.driver.find_element(*LoginPage.submitButton)
            submitBttn.click()
    
        def login(self, id, password):
            self.set_password(password)
            self.set_email(id)
            self.click_submit()
    

Any help is appreciated


Answer: I think here:

    
    
    loginpage = homePage(self.driver)
    

you meant to instantiate the `LoginPage` class:

    
    
    loginpage = homePage.LoginPage(self.driver)
    

