Windows 有没有像 xvfb 或 xnest 这样的东西?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/944086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there anything like xvfb or xnest for Windows?
提问by Nat
On projects with end-to-end tests that drive the GUI, it is awkward to run the tests on a developer workstation because the GUI automation driver interferes with the desktop. It moves the mouse, steals focus away from apps we want to use, and can start typing text into the wrong application if we switch to another app during a test run.
在具有驱动 GUI 的端到端测试的项目中,在开发人员工作站上运行测试很尴尬,因为 GUI 自动化驱动程序会干扰桌面。它移动鼠标,从我们想要使用的应用程序上窃取焦点,如果我们在测试运行期间切换到另一个应用程序,它可能会开始在错误的应用程序中输入文本。
On Linux we've solved this by running the application under test on a virtual X server (xvfb or xnest). With xnest we can watch the tests running but still use the real desktop without interference.
在 Linux 上,我们通过在虚拟 X 服务器(xvfb 或 xnest)上运行被测应用程序解决了这个问题。使用 xnest,我们可以观看正在运行的测试,但仍然可以不受干扰地使用真实桌面。
Is there anything equivalent for Windows?
Windows 有什么等价的东西吗?
采纳答案by Nat
I found a freeware program called "RunProcess.exe" written by Frank P. Westlake that can run a process bound to the desktop of a non-interactive (e.g. off-screen) WindowStation. However, there is no source.
我找到了一个由 Frank P. Westlake 编写的名为“RunProcess.exe”的免费软件程序,它可以运行绑定到非交互式(例如屏幕外)WindowStation 桌面的进程。但是,没有来源。
Therefore I've implemented my own version (simpler than Frank Westlake's) with Java and JNA. It's in the Window Lickerrepository in the tools module. The class is called com.objogate.wl.win32.RunOnDesktop
. At some point I may port it to C and make it a normal command-line .exe, or maybe turn it into an Ant task for running tests off-screen.
因此,我用 Java 和 JNA 实现了我自己的版本(比 Frank Westlake 的更简单)。它位于工具模块的Window Licker存储库中。该类称为com.objogate.wl.win32.RunOnDesktop
. 在某些时候,我可能会将它移植到 C 并使其成为普通的命令行 .exe,或者可能将其转换为 Ant 任务以在屏幕外运行测试。
回答by Yauheni Sivukha
回答by LeeD
I just tried the multiple desktop method on my Windows 10 machine. I'm running Selenium Javascript tests. I started the tests on another desktop and waited for it to open the browser, then switched back to my main desktop. But at the same point where the Chrome browser would become the active window, now it actually forced me back to that desktop :-(
我刚刚在我的 Windows 10 机器上尝试了多桌面方法。我正在运行 Selenium Javascript 测试。我在另一个桌面上开始测试并等待它打开浏览器,然后切换回我的主桌面。但在 Chrome 浏览器将成为活动窗口的同时,现在它实际上迫使我回到那个桌面:-(
I think I'll try RunProcess.exe, or Nat's solution.
我想我会尝试 RunProcess.exe 或 Nat 的解决方案。