我在Linux中通过Selenium使用Chrome浏览器时遇到以下错误:
ERROR:browser_main_loop.cc(1512)] Unable to open X display.
ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
您是否有解决以下错误的方法?
此错误消息...
ERROR:nacl_helper_linux.cc(308)] NaCl helper process running without a sandbox!
...表示未配置系统中sandbox的setuid,因此程序无法启动/产生新的Browsing Context,即Chrome Browser] >会话。
一种快速的解决方案是,如果您想运行Chrome并且仅使用名称空间沙箱,则可以设置标志:
--disable-setuid-sandbox
此标志将禁用setuid沙箱(仅Linux)。但是,如果您在没有适当的内核支持名称空间沙箱的主机上执行此操作,Chrome将不会启动。另外,您也可以使用标志:
--no-sandbox
此标志将为通常被沙盒化的所有进程类型禁用沙盒。
示例:
chromeOptions: {
args: ['--disable-setuid-sandbox', '--no-sandbox']
},