无头浏览器在自动化方面的差异 [英] Difference of Headless browsers for automation

查看:231
本文介绍了无头浏览器在自动化方面的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主要区别是,在GUI基和非GUI基(无头)上执行.

The main difference is, execution on GUI bases and non GUI bases(Headless).

我正在寻找所有无头浏览器之间的差异,但是很遗憾,我没有找到任何差异.我一个接一个地经历,这使我更加困惑.如果某人可以分享具有差异的简短信息,那就太好了,这很清楚.

I am looking for difference between all Headless browsers with each other, But unfortunately I didn't find any. I go through one by one, Which makes more confusion. It would be great if someone can share short information with differences, which makes things clear.

推荐答案

浏览器

浏览器 是一种应用程序,它提供了一种查看万维网上的所有信息并与之交互.从技术上讲, 浏览器 ,也称为 Web浏览器 Internet浏览器,是一个客户端程序,它使用HTTP(超文本传输​​协议)代表浏览器用户向整个Internet上的Web服务器发出请求.

Browser

A Browser is an application program that provides a way to look at and interact with all the information on the World Wide Web. Technically a Browser, alternatively referred as a Web Browser or Internet Browser, is a client program that uses HTTP (Hypertext Transfer Protocol) to make requests of Web servers throughout the Internet on behalf of the Browser User.

无头浏览器也是 Web浏览器,但没有图形用户界面(GUI),但可以通过编程方式进行控制,可以广泛用于自动化测试和其他目的.

A Headless Browser is also a Web Browser but without a graphical user interface (GUI) but can be controlled programmatically which can be extensively used for automation, testing, and other purposes.

使用无头浏览器有很多优点和缺点.使用无头浏览器对于浏览网络可能不是很有帮助,但是对于自动化任务和测试来说,它很棒.

There are a lot of advantages and disadvantages in using the Headless Browsers. Using a headless browser might not be very helpful for browsing the Web, but for Automating tasks and tests it’s awesome.

使用无头浏览器有很多优点.一些tham如下:

There is a lot of advantages in using Headless Browsers. Some of tham are as follows:

  • 使用无头浏览器的明显优势是它们通常比真实的浏览器快.更快的原因是因为我们没有启动浏览器GUI ,并且可以绕过真实浏览器加载 CSS JavaScript ,然后打开并呈现 HTML DOM .
  • 在性能方面,使用无头浏览器时,通常可以看到 2x 15x 更快的性能.
  • 尽管抓取网站,您不一定想要手动启动网站.因此,您可以无忧无虑地访问网站,而只需抓取HTML.您无需渲染完整浏览器即可.
  • 许多开发人员使用 Headless Browser 进行网站和移动应用的单元测试 代码更改.能够从命令行执行所有这些操作而无需手动刷新或启动浏览器,这可以为他们节省很多精力.
  • A definite advantage of using Headless Browsers is that they are typically faster than real browsers. The reason for being faster is because we are not starting up a Browser GUI and can bypass all the time a real browser takes to load CSS, JavaScript and open and render HTML DOM.
  • Performancewise you can typically see a 2x to 15x faster performance when using a headless browser.
  • While Scraping Websites you don’t necessarily want to have to manually start up a website. So you can access the website headlessly and just scrape the HTML. You don’t need to render a Full Browser to do that.
  • Lot of developers use a Headless Browser for unit testing code changes for their websites and mobile apps. Being able to do all this from a command line without having to manually refresh or start a browser saves them lots and effort.

出于多种原因,您可能选择使用 Real Browser 代替 Headless Browser .几个实例:

There can be number of reasons why you may opt to use a Real Browser instead of a Headless Browser. A couple of instances:

  • 您需要模仿真实用户.
  • 您需要直观地查看测试运行.
  • 如果您需要进行大量调试,那么无头调试可能会很困难.

正如您正确指出的那样, ...主要区别在于在GUI基和非GUI基(无头)上的执行... ,因此从 Testing Perspective 很大程度上取决于任何特定浏览器在引擎盖下实现的浏览器引擎.例如,下面是一些浏览器引擎,它们可以完全呈现​​网页或在虚拟DOM中运行JavaScript.

As you rightly pointed that ...the main difference is in the execution on GUI bases and non GUI bases(Headless)..., so from Testing Perspective a lot will depend on the Browser Engine implemented under the hood by any particular browser. For example, here are some of the Browser Engines which fully render web pages or run JavaScript in a virtual DOM.

  • 铬嵌入式框架: CEF 是基于具有 JavaScript 支持和 BSD 许可的Google Chromium项目.
  • Erik : Erik 无头浏览器在具有 Swift 支持和 MIT 许可的Kanna和WebKit之上.
  • jBrowserDriver : jBrowserDriver 是与硒兼容的无头浏览器是基于WebKit的,并通过 Java 绑定支持和 Apache License v2.0 与 Selenium Server 一起使用. strong>许可证.
  • PhantomJS :PhantomJS是一款无头WebKit,可使用JavaScript API编写脚本.它具有对各种Web标准的快速本地支持:DOM处理,CSS选择器,JSON,Canvas和带有 JavaScript Python Ruby 的SVG , Java C# Haskell Objective-C Perl PHP R (通过 Selenium )支持和 BSD 3条款许可.
  • Splash :Splash是具有HTTP API的JavaScript呈现服务.这是一个具有HTTP API的轻量级浏览器,使用Twisted和QT在Python中实现,具有几乎所有的laungage绑定技术和 BSD 3-Clause 许可证.
  • Chromium Embedded Framework: CEF is a open source project based on the Google Chromium project with JavaScript support and BSD license.
  • Erik: Erik is a Headless Browser on top of Kanna and WebKit with Swift support and MIT license.
  • jBrowserDriver: jBrowserDriver is a Selenium-compatible Headless Browser which is WebKit-based and works with Selenium Server through Java binding support and Apache License v2.0 license.
  • PhantomJS: PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG with JavaScript, Python, Ruby, Java, C#, Haskell, Objective-C, Perl, PHP and R(via Selenium) support and BSD 3-Clause license.
  • Splash: Splash is a javascript rendering service with an HTTP API. It's a lightweight browser with an HTTP API, implemented in Python using Twisted and QT with almost all the laungage binding arts and BSD 3-Clause license.

您可以在哪些驱动程序支持"no-browser"中找到相关的讨论./无头"测试?

这篇关于无头浏览器在自动化方面的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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