的Chrome 59 removed support for https://user:[email protected] URLs。硒铬60无头处理基本身份验证SAML对话框通过HTTPS
我有需要与Chrome Version 60 on Windows in 'headless' mode
ChromeOptions options = new ChromeOptions();
options.AddArgument("headless");
driver = new ChromeDriver(chrome, options);
这里工作一个C#硒测试SAML鉴定所需的对话框我想处理Windows的:基于这里给出的答案
:How to handle authentication popup with Selenium WebDriver using Java)我可以看到几个工作在Firefox处理这一点,但在无头模式没有为Chrome 60。
我试过下面的代码与访问凭据的URL访问测试中的网址(不含凭证)之前,但它似乎有一个bug使用Chrome 60
goTo("http://user:[email protected]"); // Caches auth, but page itself is blocked
goTo("http://localhost"); // Uses cached auth, page renders fine
// Continue test as normal
我可以看到以下在火狐代码处理认证和对话从来没有弹出:
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "https://saml.domain.com");
profile.EnableNativeEvents = false;`
我已经试过了第二种方法(using AutoIt),以及适用于Chrome 60,但做ES在无头模式在Chrome 60 不工作。
//Use AutoIt to wait 4 seconds for the authentication required dialog to appear
au3.Sleep(4000);
//Use AutoIT to send in the credentials from app.config that are encrypted
au3.Send(USERNAME + "{TAB}" + PASSWORD + "{ENTER}");
//Refresh the page
driver.Navigate().Refresh();
我希望有一个更好的解决方案,现在在2017年,并且有将与Chrome的60 无头模式下工作,任何指针的方法?
只是要清楚:试图使用,因为子资源请求都会被封锁embedded credentials将不使用Chrome V59 +工作。
可能重复的[Python Selenium Alert - 提示用户名和密码不起作用](https://stackoverflow.com/questions/45328654/python-selenium-alert-prompt-username-password-is-not-working) – DebanjanB
你可以检查这个[** Question/Discussion/Thread **](https://stackoverflow.com/questions/45345882/selenium-other-way-to-basic-authenticate-than-via-url/45352660?noredirect = 1#comment77716943_45352660)。 – DebanjanB
我运行硒测试时,也仍然可以在Chrome浏览器中登录提示。在Windows上,这两种建议都不适用于Chrome 60无头模式。 – IanC