Selenium C# - 处理SignIn对话框(Chrome)

问题描述 投票:0回答:1

我有一个问题,当我登陆网站的第一页时,会出现授权弹出窗口。

enter image description here

我需要点击输入按钮或刷新页面(关闭弹出窗口)..任何人都可以帮我处理弹出窗口。弹出时我尝试了Driver.Navigate()。Refresh()。这不会刷新页面(这将导致关闭弹出窗口)

除了使用AutoIT dll之外,还有其他方法可以关闭弹出窗口。 enter image description here

非常感谢您对此的帮助

c# selenium authentication dialog
1个回答
0
投票

以下是如何在C#中处理警报的文档。 IAlert Interface

尝试以下逻辑来处理您的方案。

IAlert alert = driver.SwitchTo().Alert();
alert.Dismiss();

完成后,请务必切换回父窗口。

© www.soinside.com 2019 - 2024. All rights reserved.