比如量角器VS浏览器 [英] Protractor instance vs browser
问题描述
我试图抬起头来类似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 instanceelement(locator)
is the new syntax forptor.findElement(locator)
by[strategy]
is the new syntax forprotractor.By.[strategy]
下面是新的文档: http://angular.github.io/protractor/#/api
这篇关于比如量角器VS浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!