关闭invisib

2024-09-27 00:19:21 发布

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

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

...
driver.get("mypage")
driver.find_element_by_link_text("login")
# Here comes the enter pin window (popup)
...

驱动块。opensmc驱动程序发送的“输入智能卡pin”窗口似乎有问题。 为了解决这个问题,我使用xdotool输入键。你知道吗

现在我在选择任何元素或切换到任何页面时得到一个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_element都会导致tryUnexpectedAlertException

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


Tags: thetextgetbydriverselenium驱动程序pin

热门问题