Selenium WebDriver和Selenium服务器 [英] Selenium WebDriver and Selenium server

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

问题描述

我需要您的帮助来接线与硒有关的东西. 现在,在过去的几周里,我一直在阅读有关Selenium文档的信息. 有Selenium IDE(用于记录和重播测试的firefox扩展) 硒RC-(硒1.0).现在似乎已弃用该方法,并使用代理HTTP服务器在多个浏览器上运行测试. Selenium Web驱动程序-(Selenium 2.0).这是最新的一种,现在应该用于自动化测试. (每个浏览器都实现Web驱动程序API) 我还读到了Web驱动程序与本机浏览器支持交互以实现自动化,并且不需要HTTP服务器.

I need your help to wire things related to selenium. Now over the past few weeks I have been reading about Selenium documents. There is selenium IDE (a firefox extension for record and replay tests) Selenium RC - (selenium 1.0). This seems to be deprecated now and uses a proxy HTTP server to run test on multiple browsers. Selenium Web Driver - (selenium 2.0). This is the latest one and one which should be used now for automated tests. (Each browser implements Web Driver API) I also read that web driver interacts with native browser support for automation and does not require HTTP server.

然后有此Selenium服务器. (用Java编写的硒独立服务器) 与硒服务器的交互是通过JSON有线协议进行的. (其中每个语言绑定调用Selenium服务器通过HTTP传递JSON数据)

Then there is this Selenium server. (selenium stand alone server written in java) The interaction with selenium server is via JSON wire protocol. (where each language binding call selenium server passing JSON data over HTTP)

现在我有以下问题:

  1. Selenium服务器是否与selenium中使用的代理服务器相同 RC?

  1. Does the Selenium server same as the proxy server used in selenium RC?

硒RC是否使用JSON有线协议.

Does the selenium RC uses JSON wire protocol.

如果有Web驱动程序,Selenium 2.0中适合使用的硒服务器在哪里 与本机浏览器的自动化支持进行交互.

Where is selenium server fits in Selenium 2.0, if web driver interacts with native browser support for automation.

可以说我正在使用硒2.0,Java客户端运行测试 库,在chrome浏览器中.当我调用WebDriver API时,它是如何工作的 与chrome驱动程序交互?它使用JSON有线协议吗?

Lets say I am running my tests using selenium 2.0, java client library, in chrome browser. When I call a WebDriver API, how does it interacts with chrome driver? Does it uses JSON wire protocol?

... 我还有更多问题,但是需要以上问题的答案才能清除脑中的硒云.

... I have more questions, but needs the answer of the above ones to clear Selenium cloud in my head.

推荐答案

1- Selenium Server 2.0与Selenium RC兼容.从1.0到2.0的版本提升主要是因为它们向服务器添加了WebDriver API.因此,Selenium Server 2.0包括Selenium RC.

1- Selenium Server 2.0 is compatible with Selenium RC. The version bump from 1.0 to 2.0 was mainly because they add WebDriver API to the server. So, Selenium Server 2.0 kind of include Selenium RC.

几个月前,他们从Selenium Server中删除了Selenium RC API,这是再次将版本号提高到3.0的主要因素.

A few months ago they removed the Selenium RC API from Selenium Server, being that the main factor to again bump the version number, this time to 3.0.

注意:您仍然可以将RC API与Selenium 3结合使用(使用Selenium Server .jar附带的旧模块),但是由于RC API是使用WebDriver而非Selenium Core实现的,因此有些测试的行为可能会有所不同.

Note: You still you can use the RC API with Selenium 3 (using a legacy module that not comes out the box with the Selenium Server .jar), but since the RC API is implemented using WebDriver instead of Selenium Core, some tests could behave differently.

2-不, JSON Wire Protocol 是WebDriver协议,即与WebDriver接口或API的绑定. W3C文档此处. JSON Wire Protocol可以看作是在客户端/服务器通信的上下文中表示的一种方式,

2- No, JSON Wire Protocol is the WebDriver protocol, kind of tie to the WebDriver Interface or API. W3C doc here. The JSON Wire Protocol could be seen as the way to represent in the context of a client/server communication, the commands defined in the WebDriver API binding (e.g. go to an specific URL, click on a element, ...).

3- Selenium Server是"WebDriver服务器".您的测试脚本可以使用JSON Wire Protocol与之通信,并发送"WebDriver命令".根据测试脚本所需的功能(例如,测试脚本要使用哪种浏览器),Selenium Server会以一种或另一种方式转发/执行"命令.

3- Selenium Server is a "WebDriver server". Your tests scripts can communicate with it using the JSON Wire Protocol and sends "WebDriver commands". Depending on the capability needed by your tests scripts (e.g. what browser your tests scripts want to use) then the Selenium Server "forward/execute" the commands in one way or another.

如果您指定要使用HtmlUnit无头浏览器,则Selenium Server不会将命令转发到任何其他进程,而是使用与Selenium Server捆绑在一起的HtmlUnitDriver执行它们.

If you specified that you want the HtmlUnit headless browser, then Selenium Server will not forward the commands to any other process but execute them using the HtmlUnitDriver that come bundled with the Selenium Server.

如果您指定要使用Chrome浏览器,则Selenium Server会将命令转发"到 ChromeDriver (对于Chrome,WebDriver驱动程序是一个完全独立的"WebDriver Server"进程).

If you specified that you want the Chrome browser, then Selenium Server will "forward" the commands to the ChromeDriver(in case of Chrome, the WebDriver driver is a completely separate "WebDriver Server" process).

通过这种方式,Selenium Server可以用于集中测试脚本之外的所有处理所有浏览器所需的负担.您可以将其配置为可以处理多种浏览器.

I this way, Selenium Server is useful to concentrate at one point, outside your tests scripts, all the neccesary burden to deal with several browsers. You can configure it to deal with several browsers.

此外,您还可以使Selenium Server表现得像网格,然后与之交谈一个端点,即集线器,它将负责将测试分发到所有已注册的节点.

Besides you can make Selenium Server behave like a grid, and just talk with one endpoint, the hub, that will be in charge to distribute the tests to all the registered nodes.

4-是的,已经部分解释了.只需添加一下即可,您可以根据需要直接将测试脚本连接到ChromeDriver.

4- Yes, partially already explained. Just add that you can connect directly from your test scripts to the ChromeDriver if you want.

这篇关于Selenium WebDriver和Selenium服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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