首页 > 解决方案 > Selenium - 元组对象不可调用

问题描述

我对测试硒有问题 - 页面对象模式。我的代码:

class FormPage(Page):
    nameConnect = (By.ID, "name")

    def nameUser(self,name):
        names = self.driver.find_element(*FormPage.nameConnect)
        names.send_keys(name)

class testUser(Page):

    start_page = FormPage(self.driver)
    start_page.nameUser('user22xx')

我的错误:

start_page.nameUser('user22xx')
TypeError: 'tuple' object is not callable

如何更改我的代码?谢谢你的帮助!

标签: pythonseleniumwebdriver

解决方案


推荐阅读