0

我正在使用 Selenoid 进行自动化。我可以在 Selenoid 上运行测试,但是,当我单击正在运行的浏览器会话时,我看不到实时执行。IE。VNC 正在断开连接。手动会话也会发生。

请参阅带有控制台输出的屏幕截图:

浏览器截图

设置:

使用 Nginx 访问远程机器(CentOS)中的 Selenoid。端口 8081 托管 selenoid,端口 8080 托管 selenoid-ui。并且浏览器图像是 selenoid/vnc_firefox:86.0。

码头工人设置

这就是我启动容器的方式

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${HOME}:/root -e OVERRIDE_HOME=${HOME} aerokube/cm:latest-release selenoid start --port 8081 --vnc
docker run -it --rm -d --name selenoid-ui --link selenoid --network selenoid -p 8080:8080 aerokube/selenoid-ui:latest --selenoid-uri http://examplefqdn.com:8081
docker run --name nginx6 -d -v /etc/ssl_temp:/etc/ssl_temp -p 80:80 -p 443:443 -p 8443:8443 nginx

下面是我用我的 Nginx.conf 尝试过的。

server {
  listen 80;
  listen 443 ssl;
  listen 8443 ssl;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-For $remote_addr;
  server_name example.com;
  ssl_certificate /etc/ssl_temp/selenoid.pem;
  ssl_certificate_key /etc/ssl_temp/example.com.key;
  location /  {
   proxy_pass http://example.com:8080;
   proxy_connect_timeout      70;
   proxy_read_timeout 86400s;
   proxy_send_timeout 86400s;
   }
   location /browser {
   proxy_pass http://example.com:8081;
   proxy_connect_timeout      70;
   proxy_read_timeout 86400s;
   proxy_send_timeout 86400s;
   }
   location /ws {
   proxy_pass http://example.com:5900;
   proxy_http_version 1.1;

   proxy_set_header Connection 'upgrade';
   chunked_transfer_encoding off;

   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header Host $host;

   proxy_buffering off;
   proxy_cache off;

   proxy_connect_timeout 600;
   proxy_read_timeout 86400s;
   proxy_send_timeout 86400s;
   }
} 

以下是我的功能配置:

DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setBrowserName("firefox");
        capabilities.setVersion("76 .0");
        capabilities.setCapability("enableVNC", true);
        capabilities.setCapability("enableVideo", true);
        capabilities.setCapability("enableLog", true);
        capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

        RemoteWebDriver driver = new RemoteWebDriver(
                URI.create("https://example.com/wd/hub").toURL(), capabilities);

以下是我的 browsers.json

{
        "chrome": {
                "default": "86.0",
                "versions": {
                        "86.0": {
                                "image": "selenoid/vnc:chrome_86.0",
                                "port": "4444",
                                "path": "/",
                                "volumes": ["/etc/ssl_temp:/etc/ssl_temp"]
                        }
                }
        },
        "firefox": {
                "default": "60.0",
                "versions": {
                        "60.0": {
                                "image": "selenoid/vnc:firefox_60.0",
                                "port": "4444",
                                "path": "/wd/hub",
                                "volumes": ["/etc/ssl_temp:/etc/ssl_temp"]
                        },
                        "65.0": {
                                "image": "selenoid/vnc:firefox_65.0",
                                "port": "4444",
                                "path": "/wd/hub",
                                "volumes": ["/etc/ssl_temp:/etc/ssl_temp"]
                        },
                        "86.0": {
                                "image": "selenoid/vnc_firefox:86.0",
                                "port": "4444",
                                "path": "/wd/hub",
                                "volumes": ["/etc/ssl_temp:/etc/ssl_temp"]
                        }
                }
        }
}

任何帮助深表感谢。提前致谢。

4

1 回答 1

1

location /ws { proxy_pass example.com:5900;

这也应该转到端口 8080。

于 2021-07-23T08:09:50.017 回答