Selenium 网格中的 HTTP 基本身份验证

HTTP Basic Auth in Selenium Grid

我想在 Selenium Grid 中实施 Basic Http Authentication 我该怎么做?例如:我想向网格发送请求,但在 URL 中没有身份验证。我需要在我们的内部 Selenium 网格中创建类似 http://username:password@mygrid.com:4444/wd/hub 的东西。我该怎么做?

好的。我能够实现我所需要的。我安装了 nginx 并向其添加了 selenium 网格端点。然后添加

auth_basic           “Grid’s Area”;
auth_basic_user_file /etc/apache2/.htpasswd; 

nginx.conf。就是这样。

请记住网格有多个 URI 并且没有任何 root(在 nginx 术语中)URI。因此,当您代理时,让我们说 /gridhttp://localhost:4444/grid/console 所有静态内容都无法提供。在这种情况下,我们需要将 / 代理到 http://localhost:4001。这是因为静态内容是从不同的 URI 提供的。在我们的例子中,它是从 /grid/resources/org/openqa/grid/images/ 提供的,它不同于 /grid/console.

SSL 工作而言,我遵循 this 指南,这非常简单。