简体   繁体   中英

Selenium C# - Dispose SignIn Dialog ( Chrome )

I have an issue where when I land on the first page in a website, a authorization pop up comes up.

在此输入图像描述

I need to either hit the enter button or do a page refresh ( which closes the pop up ) .. Can any one please help me in disposing the pop up. I tried Driver.Navigate().Refresh() when the pop up. This does not refresh the page ( which will result in closing the pop up )

Is there any other way to close the pop up apart from using AutoIT dll. 在此输入图像描述

Thanks a lot for your help on this

Here is the documentation how to handle the alerts in C#. IAlert Interface

Try the below logic to handle your scenario.

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

Make sure to switch back to parent window once this done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM