Python Selenium“module”对象在Python Selenium scrip中不可调用

2024-09-27 09:35:58 发布

您现在位置:Python中文网/ 问答频道 /正文

学习Python驱动的Selenium,在我的实践中,我不断得到以下错误。我被卡住了,需要一些指导

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

这是我的密码

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

^{pr2}$

感谢任何帮助


Tags: pytestimportselfmaindefdriverselenium

热门问题