问题描述
检查量角器,我看到有运行选项量角器,而无需使用的DirectConnect使用Selenium服务器:真正的
标志
Checking the protractor documentation, I see there is a option to run protractor without using Selenium server using directConnect: true
flag.
有什么用硒服务器,并没有比事实证明,只有浏览器,Firefox是为后者的情况下支持的其他硒服务器上运行测试,量角器之间的区别?
What is the difference between running protractor tests with a selenium server and without a selenium server other than the fact that only Chrome, Firefox are supported for the latter case?
推荐答案
首先,目前,你有4不同的内置选项/方式连接到浏览器的驱动器的:
First of all, currently, you have 4 different built-in options/ways to connect to browser drivers:
- 指定
seleniumServerJar
来在本地启动硒独立服务器 - 指定
seleniumAddress
来连接到运行Selenium服务器(本地或远程) - 设置
sauceUser
和sauceKey
连接到酱实验室远程服务器硒 - 使用
的DirectConnect
来直接连接到Chrome或Firefox。还有其他chromeDriver
和firefoxPath
设置,你可以用它来定义自定义Chrome的驱动器和Firefox的应用程序二进制文件的位置。
- specify
seleniumServerJar
to start selenium standalone server locally - specify
seleniumAddress
to connect to a running selenium server (local or remote) - set
sauceUser
andsauceKey
to connect to Sauce Labs remote selenium server - use
directConnect
to connect to Chrome or Firefox directly. There are additionalchromeDriver
andfirefoxPath
setting that you can use to define custom Chrome driver and Firefox application binary locations.
第3个选项基本上都是通过代理,硒服务器工作:
The first 3 options basically work through a "proxy", a selenium server:
服务器充当代理你的测试脚本(与写之间
的webdriver API),并且浏览器驱动器(由的webdriver控制
协议)。服务器从脚本到转发命令
从司机到脚本的驱动程序,并返回响应。
通过中间硒服务器而不是直接的webdriver连接到自动化的浏览器的主要的原因是硒服务器,如果充当,让你展开/扩展在多个浏览器,在多个系统多个浏览器你的测试,看看,例如,的。仅供参考,还有,即,除了其他功能,行为与硒的服务器,酱实验室,不同的功能/配置大量相似 - 浏览器和系统
The main reason to automate browsers through an intermediate selenium server as opposed to direct webdriver connect is that selenium server, if acts as a Selenium Grid, allows you to expand/scale your tests across multiple browsers, multiple browsers on multiple systems, see, for instance, Sauce Labs Selenium Grid. FYI, there is also BrowserStack
service, that, apart of other features, acts as a selenium server with, similarly to Sauce Labs, enormous amount of different capabilities/configurations - browsers and systems.
启动硒服务器的其他使用案例(谈到选项2),而不是使用的DirectConnect
是,你可能有一个特定的配置(S)你想你测试运行。我说,你有一台Windows计算机的IE 11在船上和Ubuntu使用Firefox 35在这种情况下,您可以配置这些机器硒节点这将连接到的。
The other use case of starting up a selenium server (speaking about option 2) and not using directConnect
is that you may have a specific configuration(s) you want your tests to run on. Say, you have a Windows machine with IE 11 on board and Ubuntu with Firefox 35. In this case, you may configure these machines as selenium nodes which would connect to a selenium server/hub.
如果您是在本地运行测试和目标浏览器是Chrome或/和Firefox,使用的DirectConnect
,您的测试将运行得更快。
If you are running your tests locally and your target browsers are Chrome or/and Firefox, use directConnect
, your tests would run faster.
但是,如果您是在本地运行测试,需要测试针对IE,Safari或其他浏览器,你会去的选项1-3(通常为1),因为这些浏览器无法在直接连接模式下工作。
But, if you are running your tests locally and need to test against IE, Safari or other browsers, you'd go with options 1-3 (usually 1), since these browsers cannot work in "direct connect" mode.
另请参阅相关主题:
- What are the differences between 'Selenium-server-standalone.jar' and 'Selenium Client & WebDriver'?
- Difference between "selenium server" and "selenium server standalone" jars
这篇关于差运行具有/不带量角器硒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!