无头Web浏览器需要Selenium WebDriver吗? [英] Do headless web browser need selenium WebDriver?

查看:184
本文介绍了无头Web浏览器需要Selenium WebDriver吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用无头Web浏览器(例如无头chrome)进行硒测试.是否必须使用硒WebDriver(用于python或c#绑定)?

I am trying to use headless web browser(such as headless chrome) for our selenium tests.Should I have to use selenium WebDriver(for python or c# bindings)?

推荐答案

无头Chrome

根据> Getting Started with Headless Chrome Headless Chrome 是不需要可见的UI外壳的服务器环境.

Headless Chrome

As per Getting Started with Headless Chrome the Headless Chrome is the server environment where you don't need a visible UI shell.

如果您已安装Chrome 59+,则可以使用--headless标志启动Chrome,如下所示:

If you've got Chrome 59+ installed, you start Chrome with the --headless flag as follows:

chrome \
  --headless \                   # Runs Chrome in headless mode.
  --disable-gpu \                # Temporarily needed if running on Windows.

chrome应该始终指向您安装的 Chrome .粗略的确切位置因平台而异.

chrome should always point to your installation of Chrome. The exact location of-coarse varies from platform to platform.

按照> ChromeDriver-适用于Chrome的WebDriver 简而言之, WebDriver 是一个开放源代码工具,可在许多浏览器中自动测试Web应用程序,它提供了导航到网页,用户输入,JavaScript执行等功能. ChromeDriver 独立服务器,它为 Chromium 实现了 WebDriver的有线协议.

As per ChromeDriver - WebDriver for Chrome, in simple words WebDriver is an open source tool for automated testing of webapps across many browsers which provides capabilities for navigating to web pages, user input, JavaScript execution, and much more. ChromeDriver is the standalone server which implements WebDriver's wire protocol for Chromium.

如果您打算在 Headless模式(即 Headless Chrome )中使用 Chrome浏览器进行硒测试您必须强制使用 ChromeDriver

If you intend to use Chrome Browser in Headless Mode(i.e. Headless Chrome) for your selenium tests you have to mandatorily use ChromeDriver

这篇关于无头Web浏览器需要Selenium WebDriver吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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