- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Selenium 从 Java 代码进行测试,它通过 maven 自动启动,当我运行 mvn verify
它使用 gecko-driver
启动新的 selenium 的 firefox
实例:
final FirefoxOptions opts = new FirefoxOptions();
if (HEADLESS_MODE) {
opts.addArguments(ARG_HEADLESS);
}
return new FirefoxDriver(opts);
它在我的机器(以及其他开发人员的机器)上以“ headless ”和正常两种模式运行良好。现在我正在尝试在 Alpine Linux Docker 容器中使用 CI 构建运行 Selenium 测试。当我尝试按原样运行它时,出现错误:
mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.pW1sbkcv98QN" Error: GDK_BACKEND does not match available displays.
然后我从 this post 安装了所有建议的工具(dbus
和 xvfb
)并在运行测试之前启动它:
apk add xvfb dbus
dbus-uuidgen > /etc/machine-id
export DISPLAY=:99
Xvfb $DISPLAY -ac &
mvn verify
但是现在 Selenium 测试等待了大约 10 秒并因错误而失败
1565433736375 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "--headless" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.1ZMsJ0Hy95V0" 1565433738424 Marionette INFO Listening on port 2828
!!! [Child][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
[Child 2191] ###!!! ABORT: Aborting on channel error.: file /home/buildozer/aports/community/firefox-esr/src/firefox-52.8.1esr/ipc/glue/MessageChannel.cpp, line 2152 [Child 2191] ###!!! ABORT: Aborting on channel error.: file /home/buildozer/aports/community/firefox-esr/src/firefox-52.8.1esr/ipc/glue/MessageChannel.cpp, line 2152
!!! [Child][MessageChannel] Error: (msgtype=0x3E0003,name=PCompositable::Msg_Destroy) Channel error: cannot send/recv
看来我在这里做错了什么,在 Alpine Linux Docker 容器中运行 headless Selenium 测试的正确方法是什么?我更愿意配置现有的 Docker 镜像而不是使用 Selenium 镜像,因为迁移成本很高。
更新:
Selenium 版本是 3.141.59
Gecko 驱动程序版本为 v0.24.0-linux64
Firefox-ESR 版本为:52.8.1-r0
更新2:
xvfb
、dbus
和导出的 DISPLAY
实际上不需要以 headless 模式运行 Firefox - 只需运行 firefox --headless
这就是全部。
最佳答案
根据 Mozilla --headless 标志在 Firefox 52-esr 中不受支持。Headless 标志是在版本 55(适用于 Linux)和 56(Mac/Windows)中引入的。请尝试最新的 Firefox ESR 版本。
关于Alpine Docker 镜像中带有 Firefox-ESR 的 Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57441584/
我需要将 OCI 镜像 list 转换为 Docker v2.2 镜像格式,反之亦然。但我找不到两者之间的任何区别,是否有任何实际区别或它们相同? 最佳答案 Docker 镜像 list V 2,模式
LNMP 是代表 Linux 系统下的 Nginx、Mariadb、PHP 相结合而构建成的动态网站服务器架构。下面使用docker制作分布式lnmp 镜像。 1、docker 分布式 lnmp
你好,我创建了一个基础镜像;但是,每当我运行 docker build . 时,我都看不到成功构建 我的 docker 文件 FROM centos:7 ARG user=john ARG home=
我想要我的 iPhone 应用程序中有一个功能,可以将图像转换为类似镜像的方式。 就像如果有一个左手举起的人的图像,那么转换后的图像必须有右手举起的同一个人。 任何代码或链接将不胜感激 预先感谢您的帮
我们希望将一个Elasticsearch集群放置在kubernetes集群的顶部(当前有2个节点,但是我们计划增加它)。 是否可以通过使集群中的每个节点包含相同数据的方式配置elasticsearch
我试图了解 docker 如何在文件系统上存储图像和图层。构建图像时,图层出现在 /var/lib/docker/image/overlay2/layerdb 中,图像出现在 /var/lib/doc
所以我最近开始使用 docker,因为我认为让我的网站 dockerised 会很好。我有一个 super 简单的 docker-compose.yml 文件,其中仅包含 wordpress:late
我有一个 docker 镜像,叫它 dockerimage/test。每次我更新它时,我都会增加一个标签,所以 dockerimage/test:1、dockerimage/test:2 等等。 当我
我开始使用 Docker,我发现我可以将主图像存储库放在不同的磁盘上(符号链接(symbolic link)/var/lib/docker 到其他位置)。 但是,现在我想看看是否有办法将它拆分到多个磁
显然应用程序打包和部署似乎有两种做法 创建 Docker 镜像并部署它 从头开始构建和部署应用程序。 我对如何使用选项 1) 感到困惑。前提是你获取一个 docker 镜像并在任何平台上重复使用它。但
我有一个 UIView具有透明背景和一些按钮。我想捕获 View 的绘图,将其缩小,然后在屏幕上的其他位置重新绘制(镜像)它。 (在另一个 View 之上。)按钮可以更改,因此它不是静态的。 最好的方
我正在为一个项目编写测试,我想测试和验证一个 docker 镜像构建。但我不想推送图像。 我希望图像构建在 CI(如 taskcluster)上并运行测试。 最佳答案 您需要使用 taskcluste
我想复制每个 html 页面中的代码,同时添加一些更改: 例子: Any text (even if includes :., 输出: Any text (even if includes :.,
我使用三星 ARM Cortex A9 Exynos4412 板。我在板上启动“linux + Qt”img。但是板上没有包管理器,也没有 make 、 gcc 命令。在/bin 文件中有文件 Bus
是否有可能以某种方式设置一个 git 存储库,该存储库像通常的 --mirror 一样用于 pull 入它,但在将从推送到另一个存储库时没有强制? 最佳答案 您可以像这样添加 --no-force 来
背景 最近在巡检过程中,发现harbor存储空间使用率已经达到了80%。于是,去看了一下各项目下的镜像标签数。发现有个别项目下的镜像标签数竟然有好几百个。细问之下得知,该项目目前处于调试阶段
以下均在centos 7进行的操作 docker安装 ? 1
我知道如何删除 N 天前创建的旧 Docker 镜像。 See here 但我真正想做的是删除过去 N 天未使用的旧 Docker 镜像。 目标是保留经常使用的图像,即使在我进行清理时没有容器实际使用
我有一个自定义的 docker 镜像,已经构建好了。没有可用的 Dockerfile。在容器内部,可以使用自定义用户,而不是 root,比如 test。此用户已附加到组 test。这是容器的默认用户。
我有一个开发数据库,我想将其提交到 docker 镜像中,然后推送到私有(private)存储库并用于本地开发和 CI 构建。 数据库保存为SQL备份,我可以通过将备份文件映射到官方镜像的/doc
我是一名优秀的程序员,十分优秀!