Chrome 59 是否支持 URL 中的基本身份验证凭据,以便与 Chromedriver 一起使用?

问题描述

在 Chrome 59 中,对将基本身份验证凭据放入 URL 的支持 - 例如 https://foo:bar@www.foo.com 已经结束 - 不久前在 https://www.chromestatus.com/feature/5669008342777856.

With Chrome 59 the support for putting basic auth credentials in URLs - like https://foo:bar@www.foo.com has ended - this was warned a while ago within https://www.chromestatus.com/feature/5669008342777856.

有没有人不得不使用 Selenium 和 Chromedriver 解决这个问题?特别是在 Python 中?

Has anyone had to work around this with Selenium and Chromedriver yet? Specifically within Python?


解决方案

在我们的情况下(通过 C# 和 NTLM auth 使用 WebDriver 进行自动测试),我们发现一旦您使用凭据点击页面,尽管您无法加载子-您仍然有权访问该浏览器会话的页面上的资源.

In our situation (automated testing using WebDriver via C# with NTLM auth) we found that once you hit the page with the credentials although you can't load the sub-resources on the page you are still authorized for that browser session.

因此,我们使用有效凭据转到我们不想测试的页面(在我们的例子中是主页),以便在我们的测试套件开始时获得授权.从那时起,我们无需任何凭据即可浏览到要测试的页面,只要我们不关闭会话,一切正常.

So we go to a page that we don't want to test (in our case the home page) with valid credentials in order to get authorized at the start of our test suite. From then on we browse to the pages we want to test without any credentials and so long as we don't close the session everything works.

相关文章