硒是否支持无头的浏览器测试? [英] Does Selenium support headless browser testing?

查看:193
本文介绍了硒是否支持无头的浏览器测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待在Selenium服务器的那一刻,我似乎并不在意,支持无头的浏览器测试的驱动程序。

I'm looking at Selenium Server at the moment, and I don't seem to notice a driver that supports headless browser testing.

除非我弄错了,它不支持它。如果你在X,你可以创建一个虚拟的帧缓冲隐藏浏览器窗口,但是这不是一个真正的无头的浏览器。

Unless I'm mistaken, it doesn't support it. If you're on X, you can create a virtual framebuffer to hide the browser window, but that's not really a headless browser.

任何人都可以告诉我吗?硒是否支持无头的浏览器测试?

Can anyone enlighten me? Does Selenium support headless browser testing?

推荐答案

您不必使用PhantomJS作为替代硒。硒包括PhantomJS webdriver的类,它的乘坐GhostDriver平台上。只需安装PhantomJS二进制文件到您的计算机。在Python中,你就可以使用:

you need not use PhantomJS as an alternative to Selenium. Selenium includes a PhantomJS webdriver class, which rides on the GhostDriver platform. Simply install the PhantomJS binary to your machine. in python, you can then use:

from selenium import webdriver
dr = webdriver.PhantomJS() 

和瞧。

这篇关于硒是否支持无头的浏览器测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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