我的UI
上有一个Clear Filter
按钮,被点击后会被删除。在
我的测试用例如下:
1) Click the Clear Filter button
2) Check that the Clear Filter button has been removed from the UI
在下面的代码中,我单击按钮,然后我再次尝试单击它,因为它不存在测试用例应该通过的,但我试图通过再次单击来验证失败,这似乎不是解决它的最佳方法。。。在
log_page.clear_filter_bttnclick()
try:
if log_page.clear_filter_bttnclick():
testrailFunctions.failed()
except NoSuchElementException:
testrailFunctions.passed()
我可以在这里使用try/except
来验证按钮是否已删除,或者是否有更好的方法来确认Clear Filter
按钮不再存在于UI
上?在
干杯
您可以检查元素是否存在。在
在python中,它应该执行如下操作:
资料来源:
Python - Selenium WebDriver - Checking element exists
或者
方法返回WebElement对象,而不是对象列表。你必须:
^{pr2}$抱歉:
verify element existence selenium
相关问题 更多 >
编程相关推荐