真实模拟浏览器 [英] Real headless browser

查看:253
本文介绍了真实模拟浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,

下面是我的问题:我是负责测试的企业Web应用程序,大量使用AJAX的。我需要建立一个系统,允许测试连续运行,无需人工干预。目前我在负载测试最感兴趣,但我想用来生成负载相同的脚本在功能测试中使用。

Here is my problem: I am in charge of testing an enterprise web application that makes heavy use of AJAX. I need to build a system that allows continuous running of tests without human intervention. Currently I am mostly interested in load testing but I want the same scripts used to generate load to be used in functional tests.

目前的loadtesting我使用的磨床。我们记录脚本,然后处理挫折感其中除其他外异步请求处理。该系统适用于现在;但是脚本很微妙,在我们的开发周期,我不能维护。我需要能够运行浏览器'通过它抽象了HTML和JavaScript的细节一种编程语言,但它必须是无头。换句话说,如果我的测试脚本,打破它必须重新present应用的实际破损。在 xvfb的运行Firefox不起作用火狐仍然使用了太多的资源,甚至一具无头的Linux机器上的xvfb 。我试过无头X服务器与下行车的webdriver的Firefox。

Currently for loadtesting I am using the grinder. We record scripts and then process the heck out of them to handle among other things the asynchronous requests. This system works for now; however the scripts are delicate and I can't maintain them during our development cycle. I need to be able to 'run a browser' via a programming language that abstracts over the details of html and javascript but it must be headless. In other words if my testing script breaks it must represent an actual breakage of the application. Running firefox in xvfb does not work as firefox still uses too much resources even on a headless linux machine running with xvfb. I tried driving firefox with webdriver under the headless x server.

我一直在努力 的HtmlUnit几天,因为这是理想的解决方案。我一直在写 的HtmlUnit司机的 Jython的,所以我可以用粉碎机使用。不幸的是我遇到JavaScript错误(即不是在Firefox / Chrome浏览器/ IE浏览器真正的错误),我想我在这路的尽头。在任何情况下,我很清楚的 的HtmlUnit,我真的需要一个替代品。

I have been working on HTMLUnit for days since this is the ideal solution. I have been writing HTMLUnit drivers in Jython and hence I can use them with the grinder. Unfortunately I am running into javascript errors (that are not real errors in firefox/chrome/IE) and I think I am at the end of the road for this. In any case I am well aware of HtmlUnit and I really need an alternative.

我知道有一些其他的解决方案( envjs 并的 zombie.js );但是,我不知道如何将这些技术开发的,我不想再浪费一周下降了死胡同。

I know there are some other solutions (envjs and zombie.js); however I don't know how developed these technologies are and I don't want to waste another week going down a dead end.

这将有多难是取源$ C ​​$ c表示无论是Firefox或WebKit和注释掉所有的渲染/ GUI调用,并创建一个真正的无头的浏览器?这种情形已经做了什么?总会有比另一种更容易做到这一点用?老实说,我无法捉摸为什么一直没有已经完成,所以我猜测它要困难得多比我预期。

How hard would it be to take the source code for either Firefox or Webkit and comment out all the rendering/GUI calls and create a real headless browser? Has this been done? Would one be easier to do this with than another? Honestly I cannot fathom why this has not been done already, so I am guessing it is much harder than I am anticipating.

我假设,如果我能得到合理的性能特点一个真正的无头的浏览器(我有一个大的服务器舰队在这个问题抛出,但它不是真正的火狐足够大以GUI渲染),那么我将被设置。

I am assuming that if I can get a truly headless browser with reasonable performance characteristics (I have a large server fleet to throw at this problem, but its not big enough for real firefox with GUI rendering) then I will be set.

任何帮助是极大AP preciated。

Any help is greatly appreciated.

推荐答案

这已被人在以上 http://www.phantomjs.org/ 已经完成。在他们自己的话说:

This has been done by the guys over at http://www.phantomjs.org/. In their own words:

PhantomJS是无头的WebKit的JavaScript API。它有各种Web标准的快速和原生支持:DOM处理,CSS选择器,JSON,Canvas和SVG

PhantomJS is a headless WebKit with JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

PhantomJS为许多其它用途的情况下基于网络的应用无头测试,现场刮,页捕捉,SVG呈现,PDF转换和最佳的解决方案。

PhantomJS is an optimal solution for headless testing of web-based applications, site scraping, pages capture, SVG renderer, PDF converter and many other use cases.

PhantomJS由Ariya陶菲克创建

PhantomJS is created by Ariya Hidayat

这篇关于真实模拟浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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