在 selenium 上使用 BeautifulSoup 和 Geckodriver 有什么区别?

What is the difference between using BeautifulSoup and Geckodriver on selenium?

我目前对使用 selenium 3 的 beautiful soup 和 geckodriver 都不熟悉。我正在做一个项目,我必须从网页上抓取 URL。

我发现它们都是用于网络抓取的,但无法区分它们之间的区别。 BeautifulSoup 和 Geckodriver 有什么区别?感谢您的帮助。

BeautifulSoup 专为网页抓取而设计。

a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree. It commonly saves programmers hours or days of work.

Geckodriver 是 Firefox 的驱动程序,通常用于在 Selenium 中进行测试。

This program provides the HTTP API described by the WebDriver protocol to communicate with Gecko browsers, such as Firefox. It translates calls into the Firefox remote protocol by acting as a proxy between the local- and remote ends.

Selenium 通常用于:

  1. 创建强大的、基于浏览器的回归自动化套件和测试
  2. 在许多环境中扩展和分发脚本

Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) be automated as well.

我只是想进一步了解 GeckoDriver

Firefox 驱动程序实现 已在 Selenium 中更改 3.0。从 Firefox 版本 47.0+ 开始,我们需要使用单独的驱动程序来与 Firefox 浏览器交互,类似于 ChromeDriver。 Firefox 的新驱动程序称为 Geckodriver

Geckodriver 提供 W3C WebDriver 协议描述的HTTP API 与Gecko 通信浏览器,例如 Firefox。它通过充当本地和远程端之间的代理,将调用 转换为 Firefox 远程协议 (Marionette)

可以跟踪 Geckodriver 版本 here