How can I detect Windows Authentication Prompts wi

2019-07-23 15:36发布

I have a C# script to test some SharePoint sites.

We are getting prompts to reauthenticate on some pages when using IE. (We suspect it is something to do with our F5 load balancer)

I want to be able to create a script that can visit pages and then let me know if the page had a Windows Authentication Prompt? At the moment I don't need to login through the prompt just detect it.

1条回答
Lonely孤独者°
2楼-- · 2019-07-23 16:12

You have to wait and catch the alert.

driver.Navigate().GoToUrl("url_where_your_WAP_is");
WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 1, 0));

IAlert simpleAlert = wait.Until(ExpectedConditions.AlertIsPresent());
simpleAlert.SetAuthenticationCredentials("user", "password");
查看更多
登录 后发表回答