是否可以在 Selenium RC 中隐藏浏览器? [英] Is it possible to hide the browser in Selenium RC?

查看:95
本文介绍了是否可以在 Selenium RC 中隐藏浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Selenium RC 来自动化一些浏览器操作,但我希望浏览器不可见.这可能吗?如何?硒网格呢?我也可以隐藏 Selenium RC 窗口吗?

I am using Selenium RC to automate some browser operations but I want the browser to be invisible. Is this possible? How? What about Selenium Grid? Can I hide the Selenium RC window also?

推荐答案

有几个选项:

  • 您可以使用 Selenium Grid,以便在完全不同的机器(或虚拟机)上打开浏览器,如果您想查看浏览器,您可以通过 VNC 或远程桌面连接连接到该机器.另外,另一个选择:如果您在该远程服务器上运行 Jenkins 前台进程,它可以在桌面上执行您的测试项目.

  • You could use Selenium Grid so that the browser is opened on a completely different machine (or virtual machine) that you can then connect to via VNC or Remote Desktop Connection if you wanted to see the browser. Also, another option: if you run a Jenkins foreground process on that remote server, it can execute your test project on the desktop.

您可以在 Linux 上的 XVFB 中无头"运行 Selenium.我从未尝试过这样做,并且怀疑这是否真的值得付出努力.http://www.alittlemadness.com/2008/03/05/运行硒无头/

You can run Selenium 'headless' on Linux in XVFB. I've never tried doing this and doubt it's really worth the effort. http://www.alittlemadness.com/2008/03/05/running-selenium-headless/

您可以将 Selenium RC 包装在 Windows 服务中.http://support.microsoft.com/kb/137890.除了 Windows 更高版本的权限限制可能会阻止 Selenium 访问桌面,就像 Windows 2000 过去允许我们这样做.

You can wrap Selenium RC in a Windows service. http://support.microsoft.com/kb/137890 . Except that permissions constraints on later versions of windows will probably prevent Selenium from accessing the desktop like Windows 2000 used to allow us to do.

另一种选择是使用 WebDriver HTMLUnitDriver 之类的东西,它不会启动真正的"浏览器.http://code.google.com/p/webdriver/.此外,您还可以使用 PhantomJS 选项以及无头 Chrome".

Another option would be to use something like WebDriver HTMLUnitDriver, which doesn't launch a 'real' browser. http://code.google.com/p/webdriver/ . Also there is a PhantomJS option as well as a 'headless Chrome' that you could use.

当然,也可以选择使用 SauceLabs 之类的服务,您可以在其中让测试在云中运行.测试完成后,您可以观看它们运行的​​视频.

Of course there's also the option of using a service like SauceLabs, where you can get your tests to be run in the cloud. After your tests have completed you can watch a video of them running.

这篇关于是否可以在 Selenium RC 中隐藏浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆