如何找到';警报警告';在网页中使用Selenium(Python)
我有以下HTML代码:如何找到';警报警告';在网页中使用Selenium(Python),python,selenium,alert,Python,Selenium,Alert,我有以下HTML代码: <button ng-show="vm.loading_update" class="alert alert-warning"> <strong>Upgrading firmware... Please Wait...</strong> </button> 我需要知道是否显示此消息以继续测试 提前感谢。使用以下代码: try: WebDriverWait(self.driver, 2).until(EC.vi
<button ng-show="vm.loading_update" class="alert alert-warning">
<strong>Upgrading firmware... Please Wait...</strong>
</button>
我需要知道是否显示此消息以继续测试
提前感谢。使用以下代码:
try:
WebDriverWait(self.driver, 2).until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".alert.alert-warning>strong")))
except:
print("The alert is not displayed!")
因为这不是一个标准警报。谢谢,它正在工作。我将删除“按钮”类型,因为在这种情况下没有意义,因为此警报消息不是可单击的项目,只是用户的信息。
try:
WebDriverWait(self.driver, 2).until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".alert.alert-warning>strong")))
except:
print("The alert is not displayed!")