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

查看:94
本文介绍了如何使用可见的浏览器在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天全站免登陆