angularjs - Waiting for element by.css() in protractor -
i have code in $scope.$broadcast
triggers event executes element.addclass()
code in controller
ctrlr.rolldice = function(){ .... stuff $scope.$broadcast('eventtype', args); }
code in directive
scope.$on('eventtype', function(){ element.addclass('class'); });
i trying wait until event has fired , element.addclass
executed in protractor test using
browser.wait(element(by.css('.activate')).ispresent,15000).then(function(ispresent){ expect(ispresent).tobe(true); });
however, following error
typeerror: cannot read property 'getwebelements' of undefined
how wait element class .activate show up ??
note element
can random visible element ...it set class. if run project in actual web browser....everything runs successfully.
try this:
browser.wait(() => $('.activate')).ispresent() ,15000); expect($('.activate').ispresent()).tobe(true);
or es5 version
browser.wait(function() { return $('.activate').ispresent(); }, 15000); expect($('.activate').ispresent()).tobe(true);
note: element(by.css('.abc')) === $('.abc')
Comments
Post a Comment