用于自动化的 Headless 浏览器的差异 [英] Difference of Headless browsers for automation

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

问题描述

主要区别在于,基于 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.

Headless Browser 也是一种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.

使用无头浏览器有很多优势.部分内容如下:

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

  • 使用无头浏览器的一个明显优势是它们通常比真正的浏览器更快.更快的原因是因为我们没有启动浏览器 GUI,并且可以绕过真实浏览器加载CSSJavaScript 打开并呈现 HTML DOM.
  • 在性能方面,使用无头浏览器时,您通常可以看到 2 倍15 倍 的更快性能.
  • 虽然抓取网站,但您不一定想要手动启动一个网站.因此,您可以无头访问该网站,只需抓取 HTML.你不需要渲染一个完整浏览器来做到这一点.
  • 许多开发人员使用无头浏览器来为他们的网站和移动应用程序进行单元测试代码更改.无需手动刷新或启动浏览器即可从命令行完成所有这些工作,为他们节省了大量精力.
  • 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.

您可以选择使用真实浏览器而不是无头浏览器的原因有很多.几个例子:

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 的执行(Headless)...,所以从 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.

  • Chromium Embedded Framework:CEF 是一个基于具有 JavaScript 支持和 BSD 许可的 Google Chromium 项目.
  • Erik:Erik 是一个无头浏览器 在 Kanna 和 WebKit 之上,具有 Swift 支持和 MIT 许可.
  • jBrowserDriver:jBrowserDriver 是一个 Selenium 兼容的无头浏览器 基于 WebKit 并通过 Java 绑定支持和 Apache License v2.0 与 Selenium Server 配合使用强> 许可证.
  • PhantomJS:PhantomJS 是一个无头 WebKit,可使用 JavaScript API 编写脚本.它对各种 Web 标准提供快速和原生支持:DOM 处理、CSS 选择器、JSON、Canvas 和 SVG with JavaScriptPythonRubyJavaC#HaskellObjective-CPerlPHPR(通过 Selenium) 支持和 BSD 3-Clause 许可.
  • Splash:Splash 是一个带有 HTTP API 的 JavaScript 渲染服务.它是一个带有 HTTP API 的轻量级浏览器,使用 Twisted 和 QT 在 Python 中实现,几乎所有的语言绑定艺术和 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.

您可以在哪些驱动程序支持无浏览器"中找到相关讨论/无头"测试?

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

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