更新时间:2022-05-14 02:36:11
我遇到了同样的问题,我认为这实际上是不可能的.
I'm hitting the same sort of problem, and I think it may actually be impossible.
问题是OSX上运行的Firefox/Chrome版本适用于OSX,而不是普通" X11-因此,即使您运行X11服务器并使用xvfb/xvnc/并传递DISPLAY =:123 ,Firefox/Chrome不在乎,因为它们不是基于X的,而是基于Carbon/Cocoa的.
The problem is that the versions of Firefox/Chrome that run on OSX are for OSX, not "plain" X11 -- so even if you run the X11 server and use xvfb / xvnc / whatever and pass in DISPLAY=:123, Firefox/Chrome don't care, because they're not X-based, they're Carbon/Cocoa-based.
您可以自己确认以下内容:
You can confirm this yourself as follows:
...,并且Firefox仍显示在您的主屏幕上.
...and Firefox still shows up on your main screen.
您可以通过其他方法进行检查-如果您执行"DISPLAY =:123123 xcalc",则xcalc将不会出现在主屏幕上,但是它将显示在xlsclients的事物列表中,因为它是X-基于.
You can check this with other things -- if you do "DISPLAY=:123123 xcalc", xcalc won't appear on the main screen, but it will show up in the list of things from xlsclients, because it's X-based.
但是,如果您尝试"DISPLAY =:123123/Applications/Calculator/Contents/MacOS/Calculator",则OSX计算器将显示在主屏幕上,因为它不是基于X的.
But if you try "DISPLAY=:123123 /Applications/Calculator/Contents/MacOS/Calculator", the OSX calculator shows up on the main screen, because it's not X-based.
(另一种可能的解决方案是使用硒服务器,但是我们的Web应用程序中断了硒服务器,因此这不是我们的选择-最后,我转而使用基于Windows的Jenkins安装,其中硒和chromedriver可以正常工作从詹金斯(Jenkins)运行时.
(another possible solution is to use selenium server, but our web app breaks selenium server so that's not an option for us -- in the end, I switched to using a Windows-based Jenkins install, where selenium and chromedriver works fine when run from Jenkins).