I am working on building out a page object model Selenium framework in Python, but I am currently getting this error "TypeError: enterEmail() missing 1 required positional argument: 'email'"
I have this as my action in a Selenium test:
LoginPage.enterLoginEmail(driver, email)
And this is the class:
class LoginPage:
def __init__(self, driver):
self.driver = driver
#Locators
email_address = 'email'
pw = 'password'
def enterLoginEmail(self, driver, email):
self.login_email = driver.find_element_by_id(email_address)
self.login_email.send_keys(email)
CodePudding user response:
You get that error because you do not have an object, so "driver" is assigned to "self", and "email" is assigned to "driver". Perhaps you meant
LoginPage(driver).enterLoginEmail(driver,email)
to create and use a temporary object.