【发布时间】:2017-07-11 04:49:19
【问题描述】:
我想在我的 docker 容器中运行 selenium 和 headless chrome 以进行测试。
我尝试在我的 .js 文件中使用以下内容在 headless chrome(在我的 docker 容器之外)中运行 selenium。这有效:
const client = webdriverio.remote({
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--disable-gpu']
},
binary: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
},
baseUrl: CONFIG.host,
logLevel: 'verbose',
waitForTimeout: 3000
})
但我无法让它在我的 docker 容器中工作。在我的 docker 容器中,我使用“FROM selenium/standalone-chrome”。我的 dockerfile 似乎没有任何问题。当我尝试运行我的硒测试时会出现问题。我将 .js 文件中的 binary_path 更改为 /opt/google/chrome/google-chrome。但测试失败,甚至无法启动客户端。
所以我尝试运行 /opt/google/chrome/google-chrome 以查看 chrome 是否有效,但随后出现此错误:
[0711/005304.226472:ERROR:nacl_helper_linux.cc(311)] NaCl helper
process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
我对此很陌生(和堆栈溢出),所以我可能错过了一些基本的东西。
【问题讨论】:
标签: javascript google-chrome selenium docker