Python selenium如何关闭chrome弹出窗口

Python selenium如何关闭chrome弹出窗口,python,selenium,Python,Selenium,我尝试了我能找到的任何东西,但我无法让selenium解除此警报。我不认为这是一个警告了,虽然,因为我没有得到任何AlertPresentException当我尝试 driver.switch_to.alert.dismiss() 有什么想法吗 以下是HTML页面的相关部分: <iframe id="teamsLauncher" src="msteams:/l/team/19:95f3ef22a37040fca83b679b64f96da1@thread.t

我尝试了我能找到的任何东西,但我无法让selenium解除此警报。我不认为这是一个警告了,虽然,因为我没有得到任何AlertPresentException当我尝试

driver.switch_to.alert.dismiss()
有什么想法吗

以下是HTML页面的相关部分:

<iframe id="teamsLauncher" src="msteams:/l/team/19:95f3ef22a37040fca83b679b64f96da1@thread.tacv2/conversations?groupId=09988212-e3a1-4187-b067-a805e512e0a4&amp;tenantId=d348f9ab-4879-4a60-ab50-5c420b11470c&amp;deeplinkId=2deee564-c6b3-4d5d-b097-93900dd14620&amp;launchAgent=join_launcher&amp;type=team&amp;directDl=true&amp;msLaunch=true&amp;enableMobilePage=true&amp;fqdn=teams.microsoft.com" style="display: none;"></iframe>
<script>var modernBrowser="fetch"in window&&"assign"in Object&&"Set"in window,bundles=[],polyfills="";function injectScript(n,e,s){var t=document.createElement("script");t.src=n,t.async=e,t.onload=s,document.body.appendChild(t)}function loadBundles(n){for(key in bundles)injectScript(bundles[key],n)}function loadPolyfills(){polyfills&&injectScript(polyfills,!1,function(){loadBundles(!1)})}bundles.push("https://statics.teams.microsoft.com/hashedjs-launcher/launcher.5c24f1e70f34f56835c7.js"),polyfills="https://statics.teams.microsoft.com/hashedjs-launcher/polyfills.1e46ca6473519cf1be5d.js",modernBrowser?loadBundles(!0):loadPolyfills(),window.addEventListener("load",function(){injectScript("https://az725175.vo.msecnd.net/scripts/jsll-4.js",!0,function(){var n={coreData:{appId:"JS:teams.microsoft.com",market:window.navigator.language||"en-US"}};awa&&awa.init&&awa.init(n)})})</script>

窗口中的var modernBrowser=“fetch”和窗口中的Object&“Set”中的“assign”,bundles=[],polyfills=“”;函数injectScript(n,e,s){var t=document.createElement(“脚本”);t.src=n,t.async=e,t.onload=s,document.body.appendChild(t)}函数loadBundles(n){for(key-in-bundles)injectScript(bundles[key],n)}函数loadPolyfills(){polyfills&injectScript(polyfills,!1,function(){loadBundles(!1)})bundles.push("https://statics.teams.microsoft.com/hashedjs-launcher/launcher.5c24f1e70f34f56835c7.js“”,polyfills=”https://statics.teams.microsoft.com/hashedjs-launcher/polyfills.1e46ca6473519cf1be5d.js,modernBrowser?loadBundles(!0):loadPolyfills(),window.addEventListener(“加载”,函数(){injectScript()https://az725175.vo.msecnd.net/scripts/jsll-4.js“,!0,function(){var n={coreData:{appId:“JS:teams.microsoft.com”,market:window.navigator.language | | |“en-US”}};awa&&awa.init&&awa.init(n)})

还尝试了actionchains,但发送escape键没有任何作用。

考虑使用pyAutoGUI库,它允许python控制鼠标和键盘。如果每次都将窗口保持在同一位置,则可以使用鼠标单击功能的静态x y坐标来接受弹出窗口,并允许您在不运行代码的情况下执行很难说的操作,但是否可以尝试使用chrome选项禁用chrome弹出窗口

chrome\u options=webdriver.ChromeOptions()
chrome\u选项。添加\u参数(“--禁用通知”)
driver=webdriver.Chrome(选项=Chrome\u选项)

我希望这能起作用。

这看起来像是一个Windows系统对话框,不是Chrome生成的任何东西,但我看不懂,所以很难说。可能只是一个jQuery UI弹出窗口,而不是警报,但我同意文本的英文翻译会有所帮助。只需复制提供的html代码,您就会得到翻译。这是打开团队应用程序的请求。这是一个JS脚本,打开一个chrome弹出窗口。翻译是:运行Microsoft团队?teams.microsoft.com希望运行此应用程序。框:始终允许teams.microsoft.com在应用程序中运行类似的链接运行microsoft Team应用程序-取消我尝试过,但没有成功,弹出窗口似乎没有任何更改。不管怎样,谢谢你。我其实不想坐在电脑前,然后用手指x和y可能会奏效。。尽管如此,我还是希望有一种编码方式,而不是autogui。