Python Selenium-关闭不可见警报

Python Selenium-关闭不可见警报,python,selenium,selenium-webdriver,selenium-firefoxdriver,Python,Selenium,Selenium Webdriver,Selenium Firefoxdriver,我需要将selenium与智能卡(opensmc)和firefox驱动程序一起使用。 之后: 司机拦住了我。opensmc驱动程序发送的“输入智能卡pin”窗口似乎有问题。 为了解决这个问题,我使用xdool输入密钥 现在,当选择任何元素或切换到任何页面时,我得到一个tryUnexpectedAlertPresentException: driver.find_element_by_link_text("logout") driver.get("http://google.com") # eac

我需要将selenium与智能卡(opensmc)和firefox驱动程序一起使用。 之后:

司机拦住了我。opensmc驱动程序发送的“输入智能卡pin”窗口似乎有问题。 为了解决这个问题,我使用
xdool
输入密钥

现在,当选择任何元素或切换到任何页面时,我得到一个
tryUnexpectedAlertPresentException

driver.find_element_by_link_text("logout")
driver.get("http://google.com")
# each throws the tryUnexpectedAlertPresentException
另一方面:

alert = driver.switch_to_alert()
alert.dismiss()
抛出NoAlertPresentException

无论如何,每进一步的
find_元素
都会导致
trunexpectedAlertException


您能解释一下这种行为以及如何避免这种情况吗?

最好是获取站点的详细信息和dom详细信息!它与站点和dom无关,因为警报是由opensmc驱动的firefox安全设备发送的,该设备会询问智能卡
alert = driver.switch_to_alert()
alert.dismiss()