断言SeleniumBase中不存在文本

2024-06-01 22:41:02 发布

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

我正在使用SeleniumBase测试一个网站。我的文本通过单击十字删除React元素,之后我想验证元素中以前的某些文本不再存在

下面是单击以删除元素并断言页面上出现某些文本的代码。我想知道是否有一种方法可以做类似self.assert_not_text("some text")的事情

        self.click_xpath(
            f"""//*[@class='ant-select-selection-item-content' and text()='{common_issue}']/
            ../*[@class='ant-select-selection-item-remove']"""
        )
        self.assert_text("Some text")

Tags: text文本self元素网站页面assert断言