这个怎么报错了呢?

self = <test_my.page.widget.Widget object at 0x04233658>
path = ‘…/page/erctext.yaml’

def spets(self,path):
    with open(path,encoding="utf-8") as f:
        stepss: list[dict]=yaml.safe_load(f)
        #element:WebElement=None
        for spet in stepss:
            if 'by' in spet.keys():
                   element=self.find(spet['by'],spet['locator'])
            if 'action' in spet.keys():
                action=spet['action']
                if action == "click":
                    element.click()
                elif action == "text":
                  element.text()

E TypeError: ‘str’ object is not callable

image
不要加括号
element.text是一个属性 不是方法,不能拿来调用

另外,提问请发到答疑区,遵守发帖规范,共同维护社区的良好秩序