0

When importing protrator in an Angualr application I try to use the function browser.waitForAngularEnabled.

When I run the code I get the error:

E/launcher - Error: TypeError: Cannot read property 'waitForAngularEnabled' of undefined

I am importing the browser in this way

   const { browser } = require('protractor');

When I click through to the protractor module in VS code I can see the browser object in there but in runtime this error is thrown.

dave
  • 62,300
  • 5
  • 72
  • 93
codeThinker123
  • 664
  • 1
  • 6
  • 16

1 Answers1

1

In Protractor, you are provided with a global browser object. So you don't need to require it, the browser object is accessible without requiring it.

Solution: Just remove the require and it will work.

Note: You have to import it only if you are working with typescript.

Yevhen Laichenkov
  • 7,746
  • 2
  • 27
  • 33