使用 VMRUN 在没有 XVFB 的 Ubuntu VM 中执行 selenium 进程

Using VMRUN to execute selenium process in Ubuntu VM without XVFB

我正在使用 VMware Workstation 中的 vmrun.exe 启动一个 Ubuntu 16 桌面虚拟机并在其中启动一个 Java selenium Firefox 进程。我可以启动脚本,但是我希望 selenium 进程可见,以防用户想要监视它。尝试使用可见 GUI 启动 firefox 时出现以下错误。

org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/home/vmdops/firefox/firefox) on port 7055; process output follows: 
Error: GDK_BACKEND does not match available displays

以下bash脚本用于启动进程

java -jar seleniumProcess.jar

我可以使用 XVFB 和 运行 内存中的 selenium 进程无头地执行进程,但是我无法直观地查看进程 运行ning。

/usr/bin/Xvfb :1 & export DISPLAY=:1
java -jar seleniumProcess.jar

firefox浏览器无法显示的正确术语是什么?

有没有办法从VMRUN启动selenium进程,让firefox浏览器正常显示?

谢谢 康特

我能够解决在命令末尾添加 -interactive 的问题

vmrun -T player -gu vmdops -gp xxxx runScriptInGuest  "C:\VMDOPS2\VMDOPS2.vmx" /bin/bash "sh /home/vmdops/autovpn/runProfiler.sh" -interactive

这在用户已经交互登录时有效。当我启动虚拟机后启动太快时,出现以下错误。

Error: The specified guest user must be logged in interactively to perform this operation

所以开机后一定要等一会