getiing AttributeError:“非类型”对象没有属性“文本”错误

2024-06-28 15:23:06 发布

您现在位置:Python中文网/ 问答频道 /正文

下面是一个创建的实用程序

def verifyelementpresence(self, xpath):
    ewait = WebDriverWait(self.driver, 20).until
    (EC.visibility_of_element_located((By.XPATH, xpath)))

并在测试用例中使用了上述实用程序

print(self.verifyelementpresence("//div[@class='layout pa-3 column']/div[2]").text)

运行时,我收到此错误AttributeError: 'NoneType' object has no attribute 'text'

有人能指出语法有什么问题吗


Tags: oftextselfdiv实用程序defdriverelement