如何在带有可见浏览器的 docker 容器中运行 Selenium 测试? [英] How can I run Selenium tests in a docker container with a visible browser?

查看:14
本文介绍了如何在带有可见浏览器的 docker 容器中运行 Selenium 测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在带有可见(非无头)浏览器的 Docker 容器中运行 Selenium 测试,我有哪些选择?

If I want to run Selenium tests inside a Docker container with a visible (not headless) browser, what are my options?

  • 我需要使用 VNC 等远程显示查看器吗?
  • 是否可以在主机上使用浏览器?(即不在 Docker 容器中的浏览器).这是如何工作的?
  • 还有其他选择吗?

推荐答案

我的结论是,典型的做法是在 Docker 容器上使用轻量级桌面环境(如 LXDE)运行 X.然后您可以使用 VNC 客户端连接到它.无法在主机上使用浏览器.

My conclusion is that the canonical way of doing this is to run X with a lightweight desktop environment such as LXDE on the Docker container. Then you can connect to it with a VNC client. Using a browser on the host is not possible.

有关其他选项,请参阅其他答案.

For other options, see the other answers.

这篇关于如何在带有可见浏览器的 docker 容器中运行 Selenium 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆