menu

Questions & Answers

Python inheritance issue (Selenium/Pytests)

Why this error appears? TypeError: LoginPage() takes no arguments enter image description hereenter image description here

base_page.py

class BasePage:
    def __int__(self, driver, url):
        self.driver = driver
        self.url = url

    def open(self):
        self.driver.get(self.url)

login_page.py

from pages.base_page import BasePage

class LoginPage(BasePage):
    def __int__(self, driver, url):
        self.driver = driver
        self.url = url

    def open(self):
        self.driver.get(self.url)

login_test.py

from pages.login_page import LoginPage

class TestLoginPage:
    def test_login(self, driver):
        login_page = LoginPage(driver, 'https://url.com/#/')
        login_page.open()

I`m trying to fix it.Using super() but i cant

Comments:
2023-01-22 00:30:15
__init__, not __int__. When you instantiate LoginPage, it jumps straight to object.__init__, which takes no arguments, because neither LoginPage.__init__ nor BasePage.__init__ are defined.
2023-01-22 00:30:16
Thanks! inattention....
Answers(0) :