比如量角器VS浏览器 [英] Protractor instance vs browser

查看:265
本文介绍了比如量角器VS浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图抬起头来类似QA的,但我无法找到一个满足我。
所以基本上我看到,在一些例子它的使用

I have tried to looked up for similar QA's but i couldn't find one to satisfy me. So basically i saw that in some examples it's used

ptor = protractor.getInstance();
ptor.get(url);

和其他一些例子,用它。

And in some other examples it's used.

browser.get(url);

因此​​次的问题是:用量角器实例和浏览器获取特定的URL有什么区别?
此外,如果我的假设附言是正确的,这是更好的做法:只使用量角器,或将它们混合。

So th question is: What's the difference using protractor instance and browser for getting specific url? Also if my assumption in the P.S. is right, which is better practice: to use only protractor, or to mix them?

P.S。此外,我看到与调试器使用相同的差异。
我知道,量角器是一个包装过的网络驱动程序,我认为protractor.getInstance()获得(URL)是browser.get(URL)。

P.S. Also i saw same difference in usage with the debugger. I know that protractor is a wrapper over web driver and i assume that protractor.getInstance().get(url) is a implicit invocatin of browser.get(url).

推荐答案

浏览器是新的,preferred语法。 浏览器相同 protractor.getInstance()

browser is the new, preferred syntax. browser is the same as protractor.getInstance().

几个版本前,引入了新的语法。主要的变化是:

A few versions ago a new syntax was introduced. The major changes were:


  • 浏览器是一个量角器实例

  • 元素(定位器)是新的语法 ptor.findElement(定位)

  • 按[策略] protractor.By新的语法。[策略]

  • browser is a protractor instance
  • element(locator) is the new syntax for ptor.findElement(locator)
  • by[strategy] is the new syntax for protractor.By.[strategy]

下面是新的文档: http://angular.github.io/protractor/#/api

这篇关于比如量角器VS浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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