不知道为什么使用模拟浏览器 [英] Not sure why use headless browser

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

问题描述

我们刚刚实施CI,而无需使用无头的浏览器,但实际的浏览器。所以,一旦有新的代码由开发team.Our烟自动化代码签入运行作为自动机器上的后台进程并发送出去的结果。它找齐如有故障发送跨截图。我们没有得到的,什么是无头使用浏览器上面的过程的优势。我们需要我们的烟脚本来得到这个报道。说提交这可以在5分钟内像选择,日历,上传等,并网页不是简单的负载控制运行一个庞大的形式。

We just implemented CI without using headless browser, but actual browser's. So once there is new code checked in by development team.Our smoke automation code runs as background process on auto machine and send out results. It evens send across screenshots if any failures. What we did not get is, what is the advantage of using headless browser to above process. We need our smoke scripts to get this coverage. Say submitting a massive form which can run for within 5 minutes with controls like Select, Calendar, Uploaded, etc and not simple load of web page.

推荐答案

无头的浏览器是一个模糊的术语,一般。人们用它来指浏览器的设计应用于headlessly运行,但也指代通常需要一个真正的显示,但在配置,允许它与虚拟显示运行运行的浏览器。后者的一个实例是具有的Xvfb运行Firefox。 (我服用的角度的描述的:这是人们谈论的浏览器是无头的,我不是在谈论这是否正确与否,这将是一个的规定的角度。)

"Headless browser" is a ambiguous term, in general. People use it to refer to browsers designed to run headlessly but also to refer to a browser that normally requires a real display but is run in a configuration that allows it to run with a virtual display. An instance of the latter would be running Firefox with Xvfb. (The angle I'm taking is descriptive: this is how people talk about browsers that are headless. I'm not talking about whether this is correct or not, which would be a prescriptive angle.)

我一般不运行带有设计headlessly运行这些浏览器的测试。为什么呢?

I don't generally run tests with those browsers designed to run headlessly. Why?


  1. 每当我比较了无头的浏览器和Chrome的性能,性能提升是非常温和的,而且这是天真地做,不尝试优化Chrome的安装速度。 (我能想象让用户的数据在RAM中(的/ dev / shm的)为例,这是我没有尝试。)

  1. Whenever I compared performance between a headless browser and Chrome, the performance gain was very modest, and this was done naively, without trying to optimize Chrome's setup for speed. (I could imagine having the user data be in ram (/dev/shm) for instance, which I did not try.)

在这一天结束时,我必须证明我的软件由真实的人使用真实的浏览器上运行。正常的人都不会使用设计成无头运行我的软件浏览器。 有没有捷径,以检查Web应用程序会与特定的浏览器。您必须使用目标浏览器,故事的结尾。即使在运行浏览器的X版本Y中的代码的不可以的保证,代码将在浏览器X版本ž工作(其中Z从Y是不同的)。我已经在Chrome的X-1和Chrome X + 1在Chrome X(其中X是某些版本号我不记得现在)工作的罚款,但严重崩溃的应用程序。没有什么比在Chrome x测试标准别的透露这一点。无论一个无头的浏览器是基于,它不是实际的浏览器应用程序的目标是测试的替代品。

At the end of the day I must certify that my software runs in real browsers used by real people. Normal people don't use browsers designed to be headless to run my software. There are no shortcuts to checking that a web application will work with a specific browser. You have to use the target browser, end of story. Even running the code in browser X version Y is not a guarantee that the code will work in browser X version Z (where Z is different from Y). I've had an application that worked fine in Chrome X-1 and Chrome X+1 but crashed badly in Chrome X (where X is some version number I cannot remember right now). Nothing else than testing in Chrome X revealed this. Whatever a headless browser is based on, it is not a substitute for testing in the actual browser your application is targeting.

相反,无头的浏览器能有怪癖其自身的不在其他浏览器中显示。我最近不得不弄清楚为什么PhantomJS从Firefox或Chrome不同的行为,当它来到处理字体的微妙之处。花费的时间搞清楚用户的怪癖不会的遭遇,因为他们不使用无头的浏览器可能会花费搞清楚,当他们使用,人们通常使用的浏览器,用户将遇到的怪癖。

Conversely, the headless browser can have quirks of its own that do not show up in other browsers. I recently had to figure out why PhantomJS was behaving differently from Firefox or Chrome when it came to dealing with font subtleties. The time spent figuring out quirks that users won't encounter because they don't use headless browsers could be spent figuring out quirks that users will encounter when they use the browsers that people normally use.

我不是说有没有很好的利用了旨在headlessly运行浏览器,但进行测试,我通过。

I'm not saying there's no good use for browsers designed to run headlessly, but for testing, I pass.

我做的,当我运行本地测试运行headful浏览器headlessly。我不希望检测窗口以显示我的桌面,除非我真的需要它。

I do run "headful" browsers headlessly when I run local tests. I don't want the test window to show up on my desktop unless I really need it.

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

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