如何使用 Selenium 单击打开应用程序警报

abu*_*na9 6 python selenium python-3.x selenium-webdriver

我尝试使用 Selenium 单击“打开应用程序警报”,但收到此错误

NoAlertPresentException: Message: no such alert
Run Code Online (Sandbox Code Playgroud)

所以基本上我试图从浏览器打开缩放应用程序

在此输入图像描述

这是我的代码:

NoAlertPresentException: Message: no such alert
Run Code Online (Sandbox Code Playgroud)

Net*_*ter 1

因为这不是浏览器警报,而是操作系统应用程序选择器,所以您无法在 Selenium 中与其交互。

请参阅:Selenium C# 如何处理“打开选择应用程序”警报?

--disable-default-apps默认情况下,您可以通过在启动 Chrome 时使用该标志来阻止这些应用程序选择器。