我正在尝试在我的自动测试中实现 POM 模型,但我在将定位器分离到另一个文件时遇到了问题。我用这个作为指南 https://selenium-python.readthedocs.io/page-objects.html
我的页面对象
from Locators.Sites.SitesLocators import SitesLocators
class ResetPasswordFirstForm(object):
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(self.driver, 20)
def button_go_to_reset_passwrod(self):
self.driver.find_element(*SitesLocators.button_go_to_reset_password).click()
def button_submit_form(self):
self.driver.find_element(*SitesLocators.button_submit_reset_password).click()
我的定位器
class SitesLocators(object):
button_go_to_reset_password = (By.CSS_SELECTOR, "a[href='#/reset-password']")
button_submit_reset_password = (By.CSS_SELECTOR, "[ng-click='send()']")
但我收到这个错误
TypeError: __init__() takes 2 positional arguments but 3 were given
分离我的定位器并正确使用它们的最佳方法是什么?
紫衣仙女
相关分类