MPH MPH - 8 days ago 6x
TypeScript Question

ExpectedConditions is undefined in protractor

I am a newbie in protractor and using protractor

Version 4.0.2

But when I have below code I get error against

import { browser } from 'protractor/globals';

let EC = protractor.ExpectedConditions;


Cannot find name 'protractor'.

Do I need to import anything specifically here?

Further I tried 'ExpectedConditions' does not exist on type 'typeof protractor'. No luck though.


For version 4.0.2 - 4.0.8, ExpectedConditions has been exported via:

import { ExpectedConditions } from 'protractor/globals';

It could also be accessed from the global protractor object:

import { protractor } from 'protractor/globals';

let EC = protractor.EC;

In version 4.0.9+, the import is slightly different. The import is no longer 'protractor/globals' and should just be from 'protractor'. For example:

import { protractor } from 'protractor';