什么是Selenium? (What is Selenium?)

Selenium is an Opensource Automation testing tool which is only meant for testing Web-based applications and cannot be used for desktop based, windows based applications. It runs in multiple browsers and multiple operating systems.

Selenium是一个开源自动化测试工具,仅用于测试基于Web的应用程序,不能用于基于桌面,基于Windows的应用程序。 它可以在多种浏览器和多种操作系统中运行。

Selenium的历史 (History of Selenium)

  • Currently, Selenium 3.0 Web is in use comprising of Selenium IDE, Selenium WebDriver and Selenium Grid.当前,正在使用的Selenium 3.0 Web由Selenium IDE,Selenium WebDriver和Selenium Grid组成。
  • Selenium 3.0 Web is a suite of tools. Selenium was actually created by Jason Huggins in 2004 as an internal tool of Thoughtworks.Selenium 3.0 Web是一套工具。 Selenium实际上是Jason Huggins于2004年创建的,它是Thoughtworks的内部工具。
  • Later on Paul Hammant joined the team at ThoughtWorks and started the second mode of development i.e. Selenium RC.后来, Paul Hammant加入了ThoughtWorks团队,开始了第二种开发模式,即Selenium RC
  • Later in 2008 Philippe Hanrigou developed Selenium Grid, which provides a hub allowing the running of multiple Selenium tests parallelly thus reducing the execution time of test scripts.Philippe Hanrigou在2008年晚些时候开发了Selenium Grid ,它提供了一个中心,可以并行运行多个Selenium测试,从而减少了测试脚本的执行时间。
  • The first version of Selenium which was launched in the market was Selenium 1.0. It was a suite of tools comprising of Selenium IDE, Selenium RC, and Selenium Grid.市场上推出的第一个Selenium版本是Selenium 1.0。 它是一套包含Selenium IDE,Selenium RC和Selenium Grid的工具。

If we go to the official website of Selenium (https://www.seleniumhq.org/download/) we can see that the latest version is 3.14. Initially, in 2007 we had Selenium RC, IDE, and Grid.

如果我们访问Selenium的官方网站(https://www.seleniumhq.org/download/),我们可以看到最新版本是3.14。 最初,在2007年,我们有了Selenium RC,IDE和Grid。

Selenium网格 (Selenium Grid)

Selenium Grid is a tool used for parallel execution of selenium scripts. For example, if we have a single machine and to this single machine, we can connect multiple machines with multiple operating systems so that we can run our test cases parallel across different machines which saves our time.

Selenium Grid是用于并行执行Selenium脚本的工具。 例如,如果我们只有一台计算机,并且要连接到这台计算机,则可以将多台计算机与多个操作系统连接在一起,这样我们就可以在不同计算机上并行运行测试用例,从而节省了时间。

SeleniumIDE (Selenium IDE)

Selenium IDE is a tool which basically runs only on Chrome and Firefox browsers. It generates no reports and cannot execute multiple test cases. For example, if we have 5000 test cases then IDE cannot work, it’s not a robust tool to execute multiple test cases. It cannot generate logs.

Selenium IDE是一个基本上只在Chrome和Firefox浏览器上运行的工具。 它不生成报告,并且不能执行多个测试用例。 例如,如果我们有5000个测试用例,则IDE无法工作,它不是执行多个测试用例的强大工具。 它无法生成日志。

SeleniumRC (Selenium RC)

Selenium RC, which is deprecated now in present market can write dynamic scripts which could work on multiple browsers. In Selenium RC, we had to learn a programming language like Python, C#, Ruby, Java to execute Selenium RC. It can generate Reports and logs.

Selenium RC(目前在当前市场中已弃用)可以编写可在多种浏览器上运行的动态脚本。 在Selenium RC中,我们必须学习Python,C#,Ruby,Java等编程语言才能执行Selenium RC。 它可以生成报告和日志。

Selenium WebDriver (Selenium WebDriver)

As time progressed the selenium guys came up with WebDriver 2.0 in 2011. It is not a migration from RC to WebDriver, it was an entirely different tool than RC, where each has its own commands.

随着时间的推移,Selenium团队在2011年提出了WebDriver 2.0。这不是从RC到WebDriver的迁移,它是与RC完全不同的工具,后者每个人都有自己的命令。

WebDriver could also make dynamic scripts and could work on multiple browsers. Like Selenium RC, it can generate reports and logs. Now in current market WebDriver 3.0 has come up which can do the things done in WebDriver 2.0 and Grid2 was evolved into Grid3.

WebDriver还可以制作动态脚本,并且可以在多个浏览器上工作。 与Selenium RC一样,它可以生成报告和日志。 现在在当前市场上已经出现了可以执行WebDriver 2.0中完成的工作的WebDriver 3.0,并且Grid2演变为Grid3。

Selenium WebDriver架构 (Selenium WebDriver Architecture)

Before starting with Selenium WebDriver Architecture, we need to know a few concepts if we want to understand the working of Selenium WebDriver. There are five components of Selenium Architecture:

在开始了解Selenium WebDriver体系结构之前,如果我们想了解Selenium WebDriver的工作原理,我们需要了解一些概念。 Selenium体系结构包含五个组件:

  1. Lanugage Binding or Selenium Client Library: It is nothing but Jar files where the language in which we write our selenium framework. It means that language which we used to write the script it may be Java, C#, Ruby, Python, Perl.Lanugage Binding或Selenium客户端库 :JAR文件只不过是我们编写Selenium框架所用的语言。 这意味着我们用来编写脚本的语言可能是Java,C#,Ruby,Python,Perl。
  2. Selenium API: API Stands for Application Programming Interface. API is a particular set of rules and specification that software programs can follow to communicate with each other. API serves as an interface between the software program and facilitate their interaction. API is software to software interaction which means API works between software to software. With the help of API application talks to each other without any user knowledge.Selenium API :API代表应用程序编程接口。 API是一组特定的规则和规范,软件程序可以遵循这些规则和规范相互通信。 API充当软件程序之间的接口,并促进它们之间的交互。 API是软件到软件的交互,这意味着API在软件到软件之间工作。 借助API应用程序,无需任何用户知识即可相互交谈。
  3. Remote WebDriver: It is an implementation class of the WebDriver interface that a test script developer can use to execute their test script through WebDriver server on the remote machine.远程WebDriver :它是WebDriver界面的实现类,测试脚本开发人员可以使用该类通过远程计算机上的WebDriver服务器执行其测试脚本。
  4. JSON Wired Protocol: JSON stands for JavaScript Object Notation. It is a lightweight data-interchange format which helps us to interchange the data. JSON is used to transfer data between client and server on the web. A simple JSON file have .json extension. JSON wired protocol send data in JSON format and server firstly parse the data and then execute the data and after that response given by the server send back to the client in JSON format.JSON有线协议 :JSON表示JavaScript对象表示法。 它是一种轻量级的数据交换格式,可帮助我们交换数据。 JSON用于在Web上的客户端和服务器之间传输数据。 一个简单的JSON文件扩展名为.json。 JSON有线协议以JSON格式发送数据,服务器首先解析数据,然后执行数据,然后服务器给出的响应以JSON格式发送回客户端。
  5. WebDriver: Webdriver is a tool for automating web applications and verifying that they work as expected.WebDriver :Webdriver是用于自动化Web应用程序并验证其是否按预期工作的工具。

Selenium WebDriver Architecture

Selenium WebDriver架构

Selenium WebDriver如何在内部工作? (How Selenium WebDriver Works Internally?)

In real time, we will write a script in languages like Java, C#, Python, Ruby, Perl. Let’s see how Selenium WebDriver works internally. Generally, you write code in Eclipse IDE (Integrated Development Environment) by using any one of the supported Selenium client libraries (Java in our case).

实时地,我们将使用Java,C#,Python,Ruby,Perl等语言编写脚本。 让我们看看Selenium WebDriver在内部如何工作。 通常,您可以使用任何一种受支持的Selenium客户端库(在本例中为Java)在Eclipse IDE(集成开发环境)中编写代码。

WebDriver driver = new ChromeDriver();
driver.get(https://www.seleniumhq.org);

Once you are ready with your script, you will click Run to execute the program. Based on the above statement, the Chrome browser will be launched and it will navigate to the SeleniumHQ website.

准备好脚本后,将单击“运行”以执行程序。 根据以上说明,将启动Chrome浏览器,并将导航到SeleniumHQ网站。

  1. Once you click on run, the selenium client library will communicate with selenium API.单击运行后,Selenium客户端库将与Selenium API通信。
  2. Selenium API will send the command taken from language level binding to browser driver with the help of JSON wired protocol.Selenium API将在JSON有线协议的帮助下将从语言级别绑定中获取的命令发送到浏览器驱动程序。
  3. Selenium API sends the request to Browser Driver, it may be Firefox driver, IE driver, Chrome driver.Selenium API将请求发送到浏览器驱动程序,它可能是Firefox驱动程序,IE驱动程序,Chrome驱动程序。
  4. The browser driver will use the HTTP server for getting the HTTP request and the HTTP Server filter out all the commands which need to be executed.浏览器驱动程序将使用HTTP服务器获取HTTP请求,并且HTTP Server过滤掉所有需要执行的命令。
  5. Then the commands in your selenium script will be executed on the browser.然后,Selenium脚本中的命令将在浏览器中执行。
  6. Finally, HTTP server sends the response back to the automation test script.最后,HTTP服务器将响应发送回自动化测试脚本。

That’s all for a quick overview of Selenium WebDriver architecture and how it works internally.

这就是对Selenium WebDriver体系结构及其内部工作原理的快速概述。

翻译自: https://www.journaldev.com/25698/selenium-webdriver-architecture

Selenium WebDriver架构相关推荐

  1. 开源应用架构之​Selenium WebDriver讲解

    WebDriver针对各个浏览器而开发,取代了嵌入到被测Web应用中的JavaScript.与浏览器的紧密集成支持创建更高级的测试,避免了JavaScript安全模型导致的限制.除了来自浏览器厂商的支 ...

  2. 开源应用架构之​Selenium WebDriver(中)

    Selenium团队最近发布了Selenium 2(又名Selenium WebDriver)​.主要新功能是集成了WebDriver​--曾经是Selenium 1(又名Selenium RC)的竞 ...

  3. 开源应用架构之​Selenium WebDriver

    这几篇文章有些看不懂,不过先存了,再细细品. (上) http://www.infoq.com/cn/news/2011/06/selenium-arch 前不久,InfoQ向大家推荐了几本有关软件架 ...

  4. 开源应用架构之​Selenium WebDriver(上)

    前不久,InfoQ向大家推荐了几本有关软件架构的新书,引起了国内读者的广泛兴趣.​其中一本是<开源应用架构(The Architecture of Open Source Application ...

  5. python webdriver点击指令_测开系列Selenium Webdriver Python(20)--Webdriver运行原理

    Webdriver运行原理 转帖请注明出处!谢谢 在开发Webdriver的自动化脚本过程中,Webdriver后台在创建WebDriver实例的过程中,先确认浏览器的原生组件中是否存在可匹配的版本. ...

  6. selenium webdriver (12) -- 鼠标和键盘

    为什么80%的码农都做不了架构师?>>>    在页面中不是每个元素都是可见的,很多时候需要鼠标操作后才会显示那个元素,因此selenium提供了ActionChains类专门处理这 ...

  7. Selenium Webdriver概述(转)

    Selenium Webdriver https://www.yiibai.com/selenium/selenium_overview.html# webdriver自动化俗称Selenium 2. ...

  8. selenium webdriver 原理概述

    背景 虽然掌握selenium webdriver提供的各种方法,就可以做web的UI自动化,但是本着知其然,也要知其所以然的态度,也为了提升自己.了解下selenium webdriver的原理是必 ...

  9. 如何使用Selenium WebDriver 驱动360 浏览器

    Selenium WebDriver 简介: Selenium WebDriver 也就是Selenium2.0, 它与Selenium1.0最大的区别是前者是通过client/server方式驱动浏 ...

最新文章

  1. adg oracle 架构_云化双活的架构演进,宁夏银行新核心搭载Oracle 19c投产上线
  2. Java中的初始化顺序
  3. 关于Spring容器管理Bean的过程以及加载模式
  4. 关于pygame和tkinter窗口的那件事-线程
  5. jsp文件上传_文件上传
  6. java_basic_review(5) java继承
  7. 句子分类_Bert做新闻标题文本分类
  8. C# Webservice
  9. 吴恩达神经网络和深度学习-学习笔记-15-局部最优
  10. 【重点】剑指offer——面试题53:正则表达式匹配
  11. Oracle函数——日期函数
  12. java云笔记_java版云笔记(一)
  13. Windows10配置和挂载联想DE2000H存储服务器
  14. springMVC-RESTful约束下dispatcher拦截对象优化
  15. 专家访谈:Flex技术对web开发的影响
  16. CF1601E Phys Ed Online题解
  17. 【STM32Cube笔记】11-中断控制器NVIC
  18. java实现html页面转pdf解决方案_[Java教程]纯js实现html转pdf
  19. Linux Ext2文件系统
  20. 矽力杰SY8088国产代替料RY3408

热门文章

  1. 工程linux下创建svn仓库目录结构
  2. 编程珠玑笔记-第12章习题
  3. vivado中的OOC技术
  4. 项目案例模板之登录注册的实现
  5. Socket 套接字和解决粘包问题
  6. 11 旋转数组的最小数字
  7. SQL Server中Rowcount与@@Rowcount的用法 和set nocount on 也会更新@@Rowcount
  8. 变量申明的提升,闭包,作用域,this,运算符优先级详细举例及讲解
  9. [转]深入理解Java 8 Lambda(语言篇——lambda,方法引用,目标类型和默认方法)...
  10. HDU 4597 Play Game