在处理UnexpectedAlertPresentException的过程中,NoAlertPresentException发生在python硒中

我正在处理经常发生的UnexpecteDalertPresentException,所以我做了try-except代码来处理它。我正要返回意外警报的内容,所以我的代码

wait = webdriverwait(driver2,10)
try:
    element = wait.until(EC.element_to_be_clickable((By.NAME,'wlike_limit')))
except UnexpecteDalertPresentException:
    print("UnexpecteDalertPresentException,",driver2.switch_to.alert.text)

但是在尝试打印意外警报的文本时,它也会给我“ NoAlertPresentException”。

UnexpecteDalertPresentException           Traceback (most recent call last)
<ipython-input-52-543c0fff5a64> in <module>
     16 try:
---> 17    element = wait.until(EC.element_to_be_clickable((By.NAME,'wlike_limit')))
     18 except UnexpecteDalertPresentException:

UnexpecteDalertPresentException: Alert Text: 
Message: unexpected alert open: {Alert text: }
  (Session info: chrome=84.0.4147.125)


During handling of the above exception,another exception occurred:

NoAlertPresentException                   Traceback (most recent call last)
<ipython-input-52-543c0fff5a64> in <module>
     17    element = wait.until(EC.element_to_be_clickable((By.NAME,'wlike_limit')))
     18 except UnexpecteDalertPresentException:
---> 19    print("UnexpecteDalertPresentException,driver2.switch_to.alert.text)
     20 

有人可以帮我解决这个问题吗?

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...