Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor instance vs browser

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); 

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. 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).

like image 288
Tek Avatar asked Feb 03 '14 12:02

Tek


People also ask

Is Protractor going to be deprecated?

TLDR. The Angular team plans to end development of Protractor at the end of 2022 (in conjunction with Angular v15).

What is Protractor browser?

Browser API is one of the most used API in Protractor, most of the code always dependent on Browser API. Browser API not just controls the operation of browser methods but also all the webdriver related activity will be taken care of by this. In Protractor, "browser" is an instance of ProtractorBrowser class.

Is Protractor still used?

Until its deprecation, Protractor supported automation of both Angular and non-Angular-based applications. Having been around for almost 9 years, the Protractor framework is still used by millions of users worldwide.

When was Protractor deprecated?

Protractor Will Be Deprecated The Angular team has announced the deprecation of Protractor in May 2021.


1 Answers

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:

  • 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]

Here is the new documentation: http://angular.github.io/protractor/#/api

like image 160
Andres D Avatar answered Oct 09 '22 13:10

Andres D