一、简介
Selenium is an umbrella project for a range of tools and libraries that enable and support the automation of web browsers
selenium是一个能够支持web浏览器自动化的工具和库
...that uses the best techniques available to remotely control browser instances and emulate a user’s interaction with the browser.
可用于远程控制浏览器实例和模拟与浏览器用户的交互。
It allows users to simulate common activities performed by end-users; entering text into fields, selecting drop-down values and checking boxes, and clicking links in documents. It also provides many other controls such as mouse movement, arbitrary JavaScript execution, and much more.
它允许用户模拟终端用户执行的常见活动,输入文本字段,选择下拉值和检查框....
Selenium supports automation of all the major browsers in the market through the use of WebDriver. WebDriver is an API and protocol that defines a language-neutral interface for controlling the behaviour of web browsers. Each browser is backed by a specific WebDriver implementation, called a driver. The driver is the component responsible for delegating down to the browser, and handles communication to and from Selenium and the browser.
Selenium通过使用WebDriver支持市场上所有主流浏览器的自动化。WebDriver 是一个定义了控制web浏览器的行为的API和协议。每个浏览器都有一个支持的特定WebDriver接口实现的驱动。它可以负责操作浏览器处理浏览器和selenium之间的通信。
二、Driver是什么
Responsible for controlling the actual browser. Most drivers are created by the browser vendors themselves. Drivers are generally executable modules that run on the system with the browser itself, not on the system executing the test suite. (Although those may be the same system.) NOTE: Some people refer to the drivers as proxies.
负责操作真实的浏览器。大多数的驱动是由浏览器厂商创造的。驱动可以执行运行在浏览器本身的系统模块,而不是系统上执行测试套件
三、原理
Communication: WebDriver passes commands to the browser through the driver, and receives information back via the same route.
如图:WebDriver通过向驱动下达指令给浏览器。同样的方式接收响应信息
Communication to the browser may also be remote communication through Selenium Server or RemoteWebDriver. RemoteWebDriver runs on the same system as the driver and the browser.
WebDriver也可以通过selenium服务器向驱动下达指令给浏览器。同样的方式接收响应信息
The test framework is responsible for running and executing your WebDriver and related steps in your tests. As such, you can think of it looking akin to the following image.
测试框架负责运行和执行webdriver 如下图
本文摘自https://www.selenium.dev/documentation,翻译可参考但不保证翻译的准确性,英语好的大家自行翻译或者查看原文档
网友评论